Dershowitz wrote last March: 

If the case reaches the Supreme Court, a major issue will be whether campaign rhetoric delivered by Donald Trump, when he was a private citizen running for president, may be considered by the courts in deciding on the constitutionality of an executive order. The lower courts gave considerable, indeed dispositive, weight to these anti-Muslim statements in deciding that the travel ban was, in reality, a Muslim ban that would violate the constitutional prohibition against discrimination on the basis of religion.  

Under that reasoning, had the identical executive order been issued by President Obama, it would have been constitutional. But because it was issued by President Trump, it is unconstitutional. Indeed any executive order issued by President Trump dealing with travel from Muslim countries would be constitutionally suspect because of what candidate Trump said. 

President Trump admitted in a tweet that it was anti-Muslim, that argument doesn't stand