If you don't cooperate, they don't have to let you into the country. They can simply tell you to turn around and go somewhere else.
If you have any doubts about that, you should visit a US-Canada border crossing. The overwhelming majority of travelers are not subjected to through inspection.