Yes, it’s constitutional to ban Muslim non-citizens from entering the country
Congress has nearly full authority to regulate immigration without interference from the courts. Because immigration is considered a matter of national security and foreign policy, the Supreme Court has long held that immigration law is largely immune from judicial review. Congress can make rules for immigrants that would be unacceptable if applied to citizens.
In 1952’s Harisiades v. Shaughnessy, the Supreme Court upheld the right of Congress to expel noncitizens who were former Communists. “In recognizing this power and this responsibility of Congress, one does not in the remotest degree align oneself with fears unworthy of the American spirit or with hostility to the bracing air of the free spirit,” Justice Felix Frankfurter wrote in his concurrence. “One merely recognizes that the place to resist unwise or cruel legislation touching aliens is the Congress, not this Court.”
There is also the more recent case of Bluman v. FEC (2011), the Supreme Court upheld the lower court’s decision that Congress can forbid foreigners from contributing to political campaigns; foreigners don’t have the same First Amendment rights as American citizens.
Of course, a Supreme Court packed with liberals can do whatever it wants, but there is ample precedent for it being constitutional to ban Muslims from entering the country. Based on Harisiades v. Shaughnessy, it would also be legal to expel resident non-citizen Muslims.