Retired cop-turned-private eye-turned-Arby’s pitchman-turned-mayoral candidate Bo Dietl wants everyone to know he isn’t a racist, because Al Sharpton “loves me.”

So, he argues, no one should think there was anything wrong when he said he knew he “had a problem” in court “as soon as I saw” that the judge “looked like Chirlane de Blasio,” the mayor’s wife.

Meaning, of course, that the judge — who rejected his attempt to enter the Democratic mayoral primary — is a black woman.

This guy has no business running for mayor.

Face it, Bo: You’ve been putting at least one foot in your mouth practically every time you open it. You’re embarrassing yourself.

And the Republican Party looks ridiculous even considering letting him enter the race. After all, his remark was the big news out of Wednesday’s GOP debate. Way to build the brand!

Yes, Dietl publicly apologized for the remark late Thursday, saying he’d “like to suck it back in my mouth” and had just been joking around. But that was after he’d spent the morning trying to defend it.

Note, too, that it’s his own fault that he’s not qualified to run as a Democrat or a Republican. Seems he tried to register simultaneously in two different parties, which canceled each other out and left him with no party.

Just the guy to put in charge of an $80 billion-plus city government, right?

To be clear: Bo Dietl will not receive this newspaper’s endorsement. The GOP, after all, has three candidates who managed to fill out their forms correctly — years ago.

And Assemblywoman Nicole Malliotakis, businessman Paul Massey and the Rev. Michael Faulkner can each make it through an entire debate without looking like a fool. These actual Republicans running for mayor deserve the coverage now going to the outrageous outsider.

Dietl wants GOP leaders to OK his run in their party under Wilson-Pakula, the 1947 law that lets non-party members run if three of the five county leaders agree. They should say “no” now.

Any Republican will face a steep uphill climb in deep-blue New York against Mayor Bill de Blasio. But the party has no hope if cameras keep focusing on the clown. You almost wonder if de Blasio put him up to it.

Dietl should end the farce for his own sake, if the GOP leaders don’t beat him to it.