If everything is as you describe, no, a police officer cannot legally do that. From your brief description, I cannot say what the police officer was suspicious of or what justification he might have thought he had.
Can you sue? Yeah, you can. If there is nothing missing from your account, he violated your 5th Amendment rights. However, since you suffered no harm beyond an inconvenience and, maybe, bruised dignity, it is doubtful that you would get much in the way of a settlement even if you won...and winning would be far from certain.

