Alan Dershowitz, the prominent lawyer who once represented convicted sex offender Jeffrey Epstein, bragged about his “perfect sex life” in defending himself against allegations he had sex with one of Epstein’s alleged victims.

The gratuitous tidbit came in response to longstanding allegations that Dershowitz was sexually involved with Virginia Giuffre, the woman who has accused Epstein of keeping her as a sex slave when she was a minor.

“I have had sex with one woman since the day I met Jeffrey Epstein,” Dershowitz told Fox News host Laura Ingraham on Thursday.

Then the Harvard Law professor unleashed an attack on Giuffre’s lawyer, David Boies.

“I challenge David Boies to say under oath that he’s only had sex with one woman during that same period of time. He couldn’t do it,” the 80-year-old Dershowitz railed. “He has an enormous amount of chutzpah to attack me and challenge my perfect, perfect sex life during the relevant period of time.”

Dershowitz, who represented Epstein in his sweetheart plea deal with Florida prosecutors in 2008, has long denied Giuffre’s allegations.

The two high-profile lawyers have been at war for years — but it escalated in April, when Boies filed a defamation suit against Dershowitz on behalf of Giuffre, the Wall Street Journal reported.

“He’s doing it for money,” Dershowitz said on Fox. “I’m going to beat him and I’m going to beat him bad.”

On Thursday, Epstein was ordered held without bail in his child sex-trafficking case.