I don't understand giving attitude to a LEO. Doesn't seem smart no matter whether the guy is a good or a bad cop. If he's a good cop, why crap on him? If he's a bad cop, why give him a reason, however flimsy, to bust your stones? I've never been in such a situation, but I'm guessing that most of the time there are only two witnesses: you and him. I suspect the judge will believe him over you.
If he takes your gun for *no reason* and won't give it back--which seems pretty unlikely--find a lawyer and go after the department. I doubt the department will stick up for the guy. I've known cops who have made good arrests, been sued, and their department settles out of court just to avoid the hassle and bad press. Returning your gun is much smaller than that.
Besides, if some screwball LEO is trying to bust your stones for no reason, remaining imperturbable is the best way to get even. It puts you at the least risk and takes away the two things he's wanting most: a reason to hassle you and the joy of getting your goat.