What people often don’t consider is that police do, believe it or not, have their own rules to follow. Granted - those rules might be based upon 60% departmental policy, 20% city hall, 17% law, and 3% public input. Part of the key to dealing with poiice (or anyone else) is to model how they think.
There are rules which outline to what extent police can be deceptive. And there are also lots of grey areas. But falsification of ID cards, badges, and other official credentials are strictly outlined. Of course, it depends upon the jurisdiction, but in most of the US only deeply undercover investigators and operatives would have fake ID materials. It’s a safe guess that a cop who pulls you over or questions you elsewhere as a cop is not undercover, because they blow that by identifying themselves as police.
So, how do you suppose police confirm whether your ID card is genuine issue? They record it, and call it in to someone who can check. You can do the same. Any given municipality will necessarily have record of who their police are.
Where street cops will usually deceive is to BS people into confessing crimes. They can say “Just admit you did it and who else is involved, and we’ll let you go.” Or things to that effect. Don’t admit to anything, or tell them anything, if you are worried about needing to take blame for it. Like they say, they can and will use it against you. They will lie to get you to incriminate yourself.
You can, but my experience is that lawyers are not very good at this kind of thing. They are more concerned, by training, to help you to avoid penalty rather than get justice. If you need an attorney, I recommend getting an activist sort. And meanwhile, boring as it is, and as much as you might initially misunderstand them - read the statutes for where you live. The actual laws, codes, ordinances, etc are usually available online. Surprisingly, most people seem to never read them. Or worse, they ask police for legal advice, which will be based upon what they prefer to see, rather than what the laws are.