axino
Are you a US citizen? If the answer is 'no' then you will either provide full access to your phone (i.e input the password for them) or you won't be allowed in the US.
If you are a US citizen then they can't deny you entry but they can seize your phone.
Having a secure phone and refusing to provide access isn't a crime in the US but, again, they can deny you entry to the US and blacklist you.
Generally, if your devices are subject to search in the first place it is because you are already on a list. If you aren't a US citizen and are outside the US then the NSA has an absolute, unfettered, unlimited right under US law to spy on you, intercept your communications, track you, build a detailed profile on you, and just generally put your entire life under a microscope.
If you have, or have applied for, a visa to enter the US then you will be prioritized.
Take the Rasha Alawieh deportation. She traveled to a location that US Intel cares about and her phone was at the location of a terrorists funeral. Those facts alone were likely enough to get her flagged by the automated algorithms for greater scrutiny. So immigration tags her for a more in depth search upon return to the US and find the pictures used to publicly justify booting her.