No judge on Earth hath the power or competence to do so - POTUS is the Commander and Chief of the military. If he ORDERS there shall be no faggots in our armed services, then that is the way it will be. Any “judge” having the temerity to rule otherwise should be stood before a firing squad, and their opinion terminated with extreme prejudice.
While I agree with you, POTUS has absolute, clear as a bell authority in who is allowed into our country as well - but that hasn’t stopped some judges from usurping that authority.