Jeffrey Epstein told his lawyers that a hulking ex-cop inflicted the injuries that left him nearly unconscious in his cell last month, a source close to the convicted pedophile’s case told The Post.

Epstein was treated for neck injuries following the July 23 incident inside the Metropolitan Correctional Center in lower Manhattan, law enforcement officials have said.

At the time, Epstein was sharing a cell with former Westchester County cop Nicholas Tartaglione, who faces a death penalty trial in four drug-related slayings upstate.

Epstein told his lawyers that “the cop roughed him up, and that’s why they got him off suicide watch,” the source said.

Tartaglione’s lawyer, Bruce Barket, disputed that account, saying, “I spoke to his lawyers and they never hinted at that to me, but he must have said something to get off suicide watch.”

“I do know that Nick was not brought up on any charges at all in the institution, so they cleared him,” Barket said.

“It’s simply, patently false to say that [Epstein] did anything other than try to kill himself at least twice, and succeeded when he succeeded.”

Barket added: “We were a little worried that he would make up something to get out of suicide watch or try and argue for bail, but it’s pretty clear what happened, given the end result here.”

The revelation came as Manhattan federal Judge Richard Berman, who was overseeing the child sex trafficking case against Epstein, released a Monday letter to the MCC’s warden in which he said that what happened on July 23 remained an “open question.”

“To my knowledge, it has never been definitively explained what the [Bureau of Prisons] concluded about that incident,” Berman wrote.

In a response dated the same day, Warden Lamine N’Diaye said that “an internal investigation was completed” but noted that “current investigations by the FBI and [Justice Department Office of Inspector General] will include this incident as well.”

“Accordingly, I cannot divulge any information about the prior investigation at this time,” N’Diaye said.

On Tuesday, Attorney General William Barr ordered the removal of N’Diaye from his post at the MCC after ripping the “serious irregularities at this facility” during a speech the previous day in New Orleans.