I'm pretty sure they can't compel you to enter a password.

They can't compel you, no. However, they can ask you to do so, and if you enter a privacy password that shows them something other than your real device (which is what this thread was about), you can very likely be faced with charges of obstruction of justice or even perjury. The point was that it's better to simply refuse, and accept the consequences of that, rather than trying to use technical means to trick them or to wipe data.

Note that if you're not a citizen of the USA, refusing to comply with a request like this is very likely to have you sent back to your country and denied access to the USA forever. While they can't legally force you to comply, they can absolutely deny you entry for any reason like this, regardless of having a valid visa and everything else in order. This even applies to legal residents.

How would they discover you entered a wrong password?

If you want to gamble on that, that's your prerogative. But if they suspect you did this, computer forensics techniques can easily reveal this, especially if the rest of the data on the device is recoverable to you as well.

Edit to add: beyond forensics, they can also simply ask you to enter the other password, to prove that the account you showed them first was the right one.

They can't, but that will put you in another "suspicious" bucket.