Prince Andrew once had a screaming match with a friend who begged him to cut ties with Jeffery Epstein — with the royal proudly declaring his ongoing loyalty to his pedophile pal, according to a report.

The showdown came after Epstein was convicted of sex with a minor, serving jail time in Florida in 2008, with friends desperate for the royal to end his 20-year friendship, according to a 2011 story in Vanity Fair.

“After Jeffrey was convicted, I phoned Andrew and told him, ‘You cannot have a relationship with Jeffrey. You can’t do these things.’ And he said, ‘Stop giving me a hard time. You’re such a puritan,'” the unidentified friend said, according to the report.

“From there, our conversation descended into a screaming match, and finally Andrew said, ‘Leave me alone. Jeffrey’s my friend. Being loyal to your friends is a virtue. And I’m going to be loyal to him.’”

The source blamed Andrew’s “stubborn streak” for his clearly unwise decision to stick by Epstein, intensifying after the pair were photographed together in Central Park in 2010 and Andrew was named as one of the men who had sex with an Epstein accuser.

“He does stupid things out of hubris, to show that he can do them,” the source told Vanity Fair at the time.

“If he likes someone, he’ll ignore the truth about that person.”

The source also insisted that Queen Elizabeth II — who recently showed her loyalty to her second son after the latest allegations — “dotes on” him and “excuses his every foible.”

The magazine insisted that the Queen still had a showdown with her son after he was first accused of having sex with one of the Epstein girls — demanding to know if there would be more surprises.

“The duke assured his mother that he had no sexual relationship with Virginia Roberts or any of Jeffrey Epstein’s girls,” the source said.

Andrew has always maintained his innocence, and recently said he was “appalled by the recent reports of Jeffrey Epstein’s alleged crimes.”

“His Royal Highness deplores the exploitation of any human being and the suggestion he would condone, participate in or encourage any such behavior is abhorrent,” Buckingham Palace said in a statement.

Authorities say Epstein, 66, hanged himself in a Lower Manhattan lockup Aug. 10 while awaiting trial on federal sex trafficking charges.