The first amendment was a restriction on the powers of congress. "Congress shall make no law" citizenship is not mentioned in the amendment.
I don't think the constitution only applies to citizens, but it doesn't come from the first amendment specifically.
The constitution makes 2 clear restrictions for which citizenship is required: the right to vote and the right to be elected to public office.
Many scholars have deduced from this that, since the framers DID explicitly restrict non-citizens in the manner above, had they intended any of the rest of the constitution to apply only to citizens they would have directly stated so.
And I think that's right.
However, it's not that simple. Over the years the supreme court has upheld otherwise unconstitutional actions against non-citizens several times, including with regard to restrictions on immigration, and including discrimination against specific ethnic groups (famously Japanese people during world war two).
My suspicion is that if laws barring immigration for Muslims were passed, whether it was held up by the supreme court would depend on the scope of the law and the makeup of the court.