An NYPD cop planted a stun gun in a driver’s SUV during a traffic stop — and got caught in the act by his own body camera, according to a new lawsuit.

Omar Prescott, of Flatbush, alleges in a lawsuit filed in Brooklyn Supreme Court Friday that two officers approached him as he was parking his Chevrolet Suburban outside his Brooklyn home.

At one point, a cop identified in the papers as Officer Carlo Cassata planted the stun gun in his glove compartment in an attempt to stick him with a now-dismissed illegal weapons charge, Prescott claims.

In body camera footage obtained by The Post, the cop is seen holding a stun gun in his hand then searching around Prescott’s car.

Then the officer backs away from the vehicle, turns on the sound on his body cam, leans back into Prescott’s vehicle and pulls what appears to be the same stun gun from the glove compartment.

Cassata said at the time that he pulled Prescott over after making an illegal u-turn and noticed marijuana in the center console.

Prescott was arrested and charged with fourth-degree criminal possession of a weapon and marijuana possession, but in June the Brooklyn District Attorney’s Office dismissed the charges and sealed the case.

Prescott is seeking unspecified monetary damages.

“Cops should be on the street to protect and serve, not to plant guns and manufacture evidence, as clearly shown in this bodycam video,” said Caitlin Robin, the managing partner at the firm representing Prescott in the case.

“Thank goodness for cops wearing body cameras — and thank goodness this cop was unaware his was on when he planted the stun gun,” she added.

The city’s Law Department and the NYPD have not responded to a request for comment. Cassata couldn’t immediately be reached for comment.