As if Prince Andrew’s embarrassing ties to a Jeffrey Epstein “sex slave” weren’t bad enough, British spymasters now worry Russia may have obtained scandal-related “kompromat” on the randy royal.

Incriminating evidence of the prince’s alleged 2001 tryst with then-17-year-old Epstein “slave” Virginia Giuffre could be in Russian hands, fears MI6, the British intelligence service.

The agency’s concerns center on the curious case of John Mark Dougan, an ex-Marine and former Palm Beach County sheriff’s deputy who now lives in Russia, The Times of London reported Saturday.

Dougan, who moved to Moscow and sought asylum there in 2016, had worked for the sheriff’s office in 2005, the year it began an investigation into Epstein. The billionaire pedophile had owned a Palm Beach mansion.

Now, almost 20 years after Andrew’s alleged tryst, a “security source” tells the Times that MI6 is concerned Dougan may still have inside information concerning Epstein and Prince Andrew.

Dougan claimed on Facebook in July he still possessed confidential documents no one had seen, the Times said.

And Dougan is known to have had contact with Pavel Borodin, a senior Russian government official who is sometimes referred to as President Vladimir Putin’s “mentor,” the Times said.

Dougan quit the Palm Beach County sheriff’s office in 2009 after three years on road patrol and became a self-appointed corruption “whistleblower.”

By 2012, he was running loose-cannon websites accusing his former fellow sheriffs of corruption, fascism and even child molestation.

“It didn’t bother me until he said I raped my son,” then-Sheriff Ric Bradshaw complained of Dougan to the Palm Beach Post in 2012.

With an FBI investigation looming, Dougan fled the US in 2016, catching a flight from Toronto to Moscow.

There, he claimed political asylum and billed himself as “BadVolf,” an exiled law-enforcement whistleblower.

In 2017 he was linked to an online story falsely accusing one of his longtime targets, Palm Beach’s then-chief deputy sheriff, of being a white supremacist who wanted to rape and kill “a black man or a Jew.”

Dougan denied involvement with the story to the Palm Beach Post at the time.

His current website says he is appearing on Russian documentaries, working for disability charities and selling self-branded Dougan’s Steaks.

The Post’s attempts to reach Dougan by phone and email were unsuccessful.