The state’s most powerful Republican secretly worked for months to help Democratic Gov. Andrew Cuomo win re-election — in exchange for Cuomo’s promise not to aid Senate Democrats in their Long Island races, a top New York GOP leader has charged.

Former state Republican Party Executive Director Michael Lawler — who managed Rob Astorino’s ill-fated gubernatorial run against Cuomo — told The Post that he learned of the alleged bombshell deal between Senate GOP leader Dean Skelos and Cuomo just days ago, after suspecting for months that it existed.

“Dean Skelos clearly was working against Rob’s campaign — he and the governor cut a deal,’’ seethed Lawler, a protégé of GOP Chairman Ed Cox.

The Nassau County-based Skelos and his aides “fight for nothing, stand for nothing except staying in power,’’ Lawler charged.

Lawler said he found out about the alleged Skelos-Cuomo arrangement from a top political aide to Nassau County Executive Ed Mangano, a Republican and Skelos ally who, in a serious setback to Astorino, endorsed Cuomo last month. “We heard rumblings that Mangano was going to [endorse Cuomo], and I reached out to his folks and was told ‘absolutely not,’ that Mangano would endorse Astorino, although he would then let Cuomo use a video of him praising the governor,’’ Lawler said.

“But after Mangano actually endorsed Cuomo in a video on TV, I called Mangano’s guy and said, ‘What the f–k?’ He said, ‘When this is over, give me a call.’

“So I called him a few days ago, and he said, ‘A deal was cut for Mangano to endorse Cuomo in exchange for Cuomo staying out of the Senate races on Long Island,’ ’’ Lawler continued. “I asked him, ‘Who cut the deal?’ And he said, ‘People higher than me.’

“I said, ‘Dean?’ And he responded, ‘That would be a pretty good guess.’ ”

Both GOP and Democratic sources had been speculating on the possibility for a while, noting that in the lead-up to last week’s election, Cuomo had been doing little to help his party win a majority in the Senate. If the governor made any appearance on behalf of a Democratic candidate on Long Island, it was a token in-and-out visit, with no follow-up and virtually no financial support, observers said.

The GOP rout of Long Island Senate seats included Jack Martins’ win over Adam Haber, Tom Croci over Adrienne Esposito and Kemp Hannon over Ethan Irwin.

Lawler said he and others in Astorino’s camp saw repeated additional evidence that Skelos — a key Cuomo political ally on such controversial measures as gay marriage and the anti-gun Safe Act — wanted the governor re-elected. “We asked Dean numerous times to hold press conferences with Rob in Nassau in reference to Cuomo’s Moreland Commission scandal, in reference to Rob’s tax, jobs and education plans, on Cuomo’s taking $37.5 million from Sandy victims for his Start-Up NY ads,’’ Lawler said. “And each time, Dean or his people either refused our request or they just didn’t respond,’’ Lawler said.

Skelos spokeswoman Kelly Cummings called Lawler’s charges “totally false,’’ insisting that “Skelos supported Astorino’’ and contending that Mangano’s decision to back Cuomo “was his own.”

A Cuomo spokesman also dismissed any deal between his boss and Skelos as a “delusion,” adding, “It’s wrong on the facts.”

But Lawler noted that ironically, Skelos would likely become leader of the new Republican-led Senate because Astorino’s presence at the top of the ticket helped three upstate GOP challengers defeat Democratic incumbents.

“The only reason Republicans will have a majority is because of Rob Astorino, who outperformed the governor in key areas including Monroe County and the Capital District, where we won,’’ Lawler said.

“Senate Republicans worked against Rob tactically, but if it wasn’t for Rob providing a strong top of the ticket in these areas, those same Senate Republicans would not have won the majority,’’ he said.

Lawler said he realized his explosive comments could cost him his future in New York politics but insisted he didn’t care.

“I’ve had enough of these f—ing people,’’ he said. “I’m happy to go on the record about all of this, and if that means I don’t get a job up in Albany, I’m happy with it.”