The Manhattan DA’s office had graphic and detailed evidence of pedophile billionaire Jeffrey Epstein’s depravity when a prosecutor inexplicably argued for leniency during his 2011 sex offender registry hearing, The Post has learned.

In advance of the hearing, then-deputy chief of Sex Crimes, Jennifer Gaffney, had been given a confidential state assessment that deemed Epstein to be highly dangerous and likely to keep preying on young girls, the DA’s office admitted in its own appellate brief eight months after the hearing.

The brief has been sealed since 2011, but The Post obtained it Thursday after suing to get it unsealed.

It describes a state assessment’s findings that Epstein should be monitored in New York as a level three offender — reserved for the most dangerous.

In making its assessment, the NY state Board of Examiners of Sex Offenders evaluated the sworn, corroborated accounts of numerous young girls who had been lured into Epstein’s Palm Beach, Fla., compound in 2005 and 2006.

Girls aged 14 to 17 years old were recruited and paid $200 to $1,000 to give Epstein erotic massages that included sexual contact, intercourse and rape, Palm Beach cops found.

Epstein pleaded guilty in Palm Beach to abusing just one of these young victims, and was required to register as a sex offender in New York since he had an Upper East Side home.

Manhattan prosecutors were aware the state board had assigned Epstein a risk assessment of 130, a number that is “solidly above the 110 qualifying number for level three,” with “absolutely no basis for downward departure,” the brief notes.

Nevertheless, Gaffney argued that he should be labeled a level one offender, the least restrictive, which would keep him off the online database.

Manhattan Supreme Court Justice Ruth Pickholz sided with the board and against Gaffney in designating Epstein a level three offender. Epstein appealed, and the DA’s change-of-heart brief agreeing that Epstein deserved the highest level of monitoring was filed in opposition to that appeal.

The appellate division ultimately upheld that Epstein be monitored as a level three offender, and he remains on the registry.

“Our prosecutor made a mistake,” Danny Frost, spokesman for DA Cyrus Vance Jr., told The Post in December, when news broke that Epstein’s sweetheart Palm Beach deal had buried evidence he had allegedly abused some 80 girls and young women.

Reached late Thursday, Frost declined to say who above Gaffney might have approved her decision to go easy on Epstein. Vance’s office has insisted that he was unaware of the sex-offender registry hearing at the time.

Gaffney could not immediately be reached for comment.

Additional reporting by Priscilla DeGregory and Laura Italiano