Cynthia Nixon is running as a self-declared knight in shining armor, vowing to hold Gov. Andrew Cuomo to account for “winning himself some gold medals” in “the corruption Olympics that is Albany.”

She gets no argument from us.

But her revulsion over government corruption suddenly turns to benign neglect when the subject is Mayor Bill de Blasio.

Asked this week about her own patron’s scandals involving shady fundraising and favors for fat cats, she replied: “I’m not running for governor, I’m running for mayor.”

OK, Nixon meant to say the exact opposite (and did correct herself), but the point is clear: Corruption only matters when it involves her opponent, not her friend.

And never mind prosecutors who — while failing to indict, given a US Supreme Court ruling that tied their hands — flatly declared the mayor’s conduct “contrary to the intent and spirit of the laws.”

Then again, Nixon is hardly the only hypocrite when it comes to corruption.

A top Cuomo aide said the governor “doesn’t know why the prosecutors gave the mayor a pass on his bribery,” referring to allegations by confessed de Blasio-briber Harendra Singh. No argument there, either; we’ve said the same. But really: Cuomo raising the corruption issue against de Blasio? Joe Percoco wasn’t on City Hall’s payroll.

Meanwhile, New Jersey’s top Democrats, including Gov. Phil Murphy and Sen. Cory Booker, turned out in force to help Sen. Bob Menendez launch his re-election campaign. This just weeks after corruption charges against him were dropped — again, thanks largely to that Supreme Court decision.

Yet not a word about all the lavish gifts Menendez routinely got from a major donor — and the favors the senator did for him. But then, those same Dems couldn’t even bring themselves to call on Menendez to resign if he was convicted.

Hypocrisy, it’s been said, is the grease that keeps society functioning. That certainly holds true for local Democrats.