A former Manhattan prosecutor who’s now a high-profile defense lawyer embroiled in the Harvey Weinstein scandal held on to his law enforcement badge after joining the private sector — and used it to try to impress a group of women, The Post has learned.

Alex Spiro — who left the Manhattan District Attorney’s Office in July 2013 — flashed his badge the following year while attending a legal conference in Miami, where he bragged that he was head of the DA’s “homicide bureau,” sources said.

There is no such bureau in the DA’s Office, and one of the women — who knew that fact — called his bluff, sources said.

Someone aware of the encounter informed the DA’s Office, and emails obtained by The Post show that Spiro was called on the carpet a short time later by Administrative Assistant District Attorney Bonnie Sard, who helps DA Cyrus Vance Jr. oversee internal operations.

At 8:04 a.m. Sept. 25, 2014, Sard emailed Spiro and asked him to meet with her the very next day.

Spiro wrote back three minutes later, saying, “Sure. Ominous email. Everything ok?”

“Don’t meant [sic] to be ominous at all — just trying to get some stuff done from home,” she replied.

The Post obtained the emails under the state Freedom of Information Law.

In addition to the Miami incident, Spiro repeatedly used his old badge to get into a restricted area in the Manhattan Criminal Courthouse known as the Early Case Assessment Bureau, where prosecutors and cops prepare criminal complaints against newly arrested defendants, sources said.

“I saw him several times after he had left, sitting in ECAB in the seats where police officers sit with prisoners,” said one person who was a prosecutor at the time.

Former Manhattan prosecutors are allowed to keep their badges on the condition that they don’t display them in public, according to several former prosecutors.

At the time of the Miami and ECAB incidents, Spiro was an associate of defense lawyer Ben Brafman, who is currently representing Weinstein against charges that the movie mogul raped a woman in 2013 and sexually assaulted another in 2004.

Earlier this month, Spiro — who now represents Jay-Z as a partner at global powerhouse Quinn Emanuel Urquhart & Sullivan — and Brafman were referenced in a class-action suit filed against Weinstein by three other accusers.

One of the plaintiffs, Melissa Thompson, claims Spiro tricked her into turning over “visual and audio evidence of Weinstein’s actions” by convincing her that he and Brafman were “working for the victims” of the movie mogul.

In response to those allegations, Brafman denied knowing about Spiro’s contact with Thompson, and Spiro said he didn’t share what he learned with Brafman or even know that Brafman was representing Weinstein at the time.

Spiro and the DA’s Office declined to comment on his alleged use of his badge.