The state’s watchdog agency has been ordered to hold a vote within 30 days on whether it will open a probe into claims that Gov. Cuomo and his former top aide Joe Percoco violated state law by using government resources for campaign purposes.

Supreme Court Judge Patrick McGrath issued the ruling after months of foot-dragging by the Joint Commission on Public Ethics on official complaints filed by state Republican Party chairman Ed Cox in February and GOP gubernatorial candidate Marc Molinaro in April.

The complaints were filed with JCOPE while Cuomo was campaigning for re-election to a third term.

Cox and the GOP then filed a lawsuit in July to compel JCOPE to act on the accusations after the ethics agency refused to say if it would do so.

At Percoco’s criminal bribery trial earlier this year, it was revealed that the Cuomo confidante made hundreds of phone calls from the governor’s office in Manhattan while he was on leave running Cuomo’s re-election campaign for a second term in 2014. Percoco was deputy secretary to the governor before becoming campaign chairman.

Percoco was sentenced to a six year prison term after being convicted of taking more than $300,000 in pay-to-play bribes.

But he wasn’t charged with any federal crimes relating to the phone calls. Misuing government resources for campaign purpose is illegal — a violation of the state Public Officers Law.

The GOP’s Cox hailed the ruling, but said it shouldn’t have taken a lawsuit to get JCOPE to do its job.

“Every New Yorker should be alarmed by the notion that the legal body responsible for rooting out corruption is beholden to the governor and apparently broke its own laws to cover up his crimes,” Cox said in a statement.

Cuomo appoints six of the 14 members to JCOPE’s governing board, including the chairman. Others are appointed by legislative leaders.

A Cuomo spokesman emphasized that the governor’s office said it would cooperate with any inquiry, adding, “We were not party to this suit.”

Cuomo has repeatedly said he did not personally break any laws.

In his eight-page ruling, McGath ordered JCOPE to “comply with executive law” by conducting a vote within 30 days on whether to open a “substantial basis investigation” into the claims against Cuomo and Percoco, and report to the court within 45 days on what action it took.