Question: do foreigners have constitutional rights?
Answer: The constitution protects the rights of non-citizens within the US territory. You are technically outside US territory when you are still at the border or the airport. Thus, these constitutional rights don't apply. As a consequence, the government has full rights to deny entry.