A judge is ordering attorney Alan Dershowitz to hand over a recorded conversation the scandal-scarred lawyer claims will discredit his accuser.

Dershowitz will need to give the tape of accuser Virginia Roberts Giuffre’s attorney to forensic examiners, a judge in Manhattan federal court ruled on Tuesday.

Judge Loretta Preska said that Dershowitz has a recording in which her lawyer David Boies allegedly says he doesn’t believe Giuffre had sex with Dershowitz.

Giuffre claims she was trafficked by Jeffrey Epstein.

A full transcript or recording of the call has never been public, but discussions in court indicate Boies admitted that Dershowitz’s travel records from the time of the alleged abuse undermine his client’s account.

Giuffre sued Dershowitz for defamation in April, after she said she’d been farmed out for sex to the Harvard law professor, and he called her a liar.

In addition to asking Preska to toss Giuffre’s lawsuit, Dershowitz is also asking the judge disqualify Boies’ firm from representing Giuffre — as he intends to call Boies and possibly others attorneys from Boies Schiller Flexner as witnesses at trial.

The judge has yet to rule on either motion, but on Monday ordered that the firebrand attorney turn over the recording of Boies “to Stroz Friedberg or a similar digital forensic firm for whatever analysis either party requests and pays for. ”

Dershowitz staunchly denies having ever met Giuffre.