I don’t know the law around this, but I have to imagine that if a person identifying themselves as a police officer refuses to provide evidence of their own identity (presumably that doesn’t have to be a name, the badge number is more likely - otherwise perps can ‘find you’), then there’s a total breakdown of executive authority and a person has every right to assume that the person dealing with them is not a police officer at all.
“Fuck you is my name” -> too many mob movies.