An angry motorist who used a fake badge to impersonate a cop pulled over the wrong taxi when the cabby turned out to be a real NYPD undercover officer, police said yesterday.

Authorities say Jarrod Kahn, 33, flicked on flashing red lights and a blaring siren to pull over two undercover cops because they drove their cab too close to his car on the Upper East Side Wednesday evening.

The officers – Charles Carlstrom and Patrick Kelly, assigned to Midtown South – were following a suspicious vehicle up Third Avenue from 42nd Street.

The cops’ cab accidentally veered into Kahn’s lane, angering him and prompting him to pull them over in his 2002 GMC Yukon at 66th Street, police said.

As soon as the puzzled cops stopped, Kahn beckoned them to approach him, sources said.

When they got to the car, the cops asked Kahn to identify himself. That’s when he whipped out a gold shield and tried to pass himself off as a cop, police said.