A prosecutor who is being probed for helping negotiate the secret plea deal that allowed pedophile Jeffrey Epstein to avoid federal charges in 2008 has resigned from the Justice Department, her lawyer said Thursday.

A. Marie Villafaña will leave her post to join the federal Department of Health and Human Services — a move she had long planned, her attorney, Jonathan Biran, said.

“She is grateful for her career in the Justice Department and excited for a new opportunity at Health and Human Services,” Biran said.

Villafaña worked with several other federal prosecutors and her former boss, Alexander Acosta, to ditch a federal indictment of Epstein in 2008 and to charge him at the state level with minor prostitution charges, the Miami Herald reported.

Epstein was arrested in New Jersey in July and hit with federal sex-trafficking charges.

The Justice Department is now probing whether Acosta — President Trump’s former labor secretary — and other federal prosecutors including Villafaña illegally negotiated the plea deal that allowed Epstein to escape federal prosecution in 2008.