Shady politicians and their backroom deals cost taxpayers at least $49,710,630.64 — enough cash to build two schools, bankroll the New York Islanders or pay for 100 new fire trucks — according to a Post analysis of documents relating to 15 city and state officials who’ve been jailed, indicted, censured or lost re-election bids under a cloud of suspicion since 2006.

The rogues gallery is led by former state Comptroller Alan Hevesi, who cost the state $36 million in pension-fund management fees after taking nearly $1 million in illegal gifts; ex-state Sen. Pedro Espada, who funneled $7 million to himself and family members through a Medicare-funded nonprofit; and Assemblyman Vito Lopez, who cost taxpayers $103,000 in secret settlements after staffers accused him of sexual harassment.

The nearly $50 million tally doesn’t include bribes accepted or money embezzled from private entities, such as the $440,000 that state Sen. John Sampson allegedly raided from foreclosure escrow accounts he was appointed to oversee. It also doesn’t count taxpayer money that was promised but never doled out, such as the $80,000 in discretionary funds City Councilman Dan Halloran allegedly said he’d allocate to a dummy company in exchange for a bribe.

Other porkers caught with their snouts in the public trough include:

* Former City Councilman Miguel Martinez, who funneled $400,000 in public money to a nonprofit partially controlled by his sister; stole $106,000 in government funding meant for a Washington Heights nonprofit; and OK’d $51,000 in fake billing invoices to his council office. He was sentenced to five years in December 2009.

* Former state Sen. Hiram Monserrate, who steered $300,000 in discretionary funds to the nonprofit Libre, which he helped lead. He was sentenced to prison in December 2012 for using some of that money to pay for a state Senate campaign.

* Ex-state Sen. Shirley Huntley, who stole $87,700 from a taxpayer-funded charity she controlled. She pleaded guilty to embezzlement in January.

* Former City Councilman Larry Seabrook, who diverted $1.5 million to himself, his family and his mistress — and notoriously submitted a $177.64 bagel receipt to the city for reimbursement. He was convicted of mail and wire fraud and conspiracy in July 2012.

* Ex-state Sen. Carl Kruger, who directed $900,000 to several nonprofits in exchange for bribes. He was sentenced to prison on federal corruption charges in April 2012.

Also, Assemblyman William Boyland Jr., is facing a fraud indictment for allegedly chiseling $67,500 in bogus travel expenses from the state. He’s also looking at other criminal counts for allegedly soliciting more than $250,000 in bribes to influence business deals, including the sale of a hospital for $8 million.