A Brooklyn man snuck into a police station house, stole official NYPD garb from a locker and then tried to pretend he was a real officer when he was caught wandering around the building in the pilfered outfit, cops said Wednesday.

Baruch Ezagui, 28 — who allegedly ransacked a cop’s locker at the at the 71st Precinct in Crown Heights on Christmas Eve — tried to claim he had been sent from headquarters at One Police Plaza.

But he didn’t fool anyone.

Crack cocaine and a crack pipe were found in his possession when he was stopped inside the precinct house around 8:10 p.m., cops said.

A police officer saw Ezagui inside the men’s locker room, stepping into NYPD boots and putting on a turtleneck and coat with an NYPD logo, according to a criminal complaint.

Then, he took out a duffel bag that had an NYPD shirt and two batons in it, the complaint states.

Luckily, the locker he allegedly grabbed the turtleneck from didn’t have a firearm in it, sources said.

When the cop confronted Ezagui, he allegedly said something to the effect of: “I am being promoted to detective I work at One Police Plaza.”

He then went to the precinct house’s kitchen and took off — but came back later, according to the complaint.

Another officer said he saw Ezagui in the women’s locker room, the document states.

Records showed that Ezagui was not in fact one of New York’s finest, the complaint says.

Police couldn’t say how Ezagui got into the precinct — nor how long he was there.

Ezagui was charged with burglary, criminal impersonation of a police officer and criminal possession of a controlled substance.

On Christmas Day at Brooklyn Central Booking, Ezagui was still claiming to be a boy in blue, police sources said.

He was held in lieu of $15,000 bail Wednesday night at his arraignment in Brooklyn Criminal Court.

The judge at his arraignment, Hilary Gingold, had set Ezagui free on supervised release a couple days prior on misdemeanor assault charges stemming from a Dec. 22 incident.

Gingold appeared peeved to be seeing Ezagui again so soon, calling him “a very troubled young man” at the arraignment.

His legal aid attorney, Steven Chakin, insisted: “He’s not incompetent.”

The assault case is one of six — including the alleged precinct invasion — Ezagui is charged in still pending in court, records show.

He has several prior arrests on his record dating back to 2016, including for burglary and drug possession.