He’s the biggest loser in Thursday’s primaries — state Sen. Jeff Klein will probably end up spending more than $3 million in his stunning loss to a 32-year-old first-time candidate.

The Klein slayer is Alessandra Biaggi, granddaughter of the late Bronx Rep. Mario Biaggi and a former lawyer in Gov. Cuomo’s office.

Sources on both sides of the race agreed that Biaggi effectively bludgeoned Klein — once a leader of the Legislature — as a tool of Republicans.

He was the head of the Independent Democratic Conference in the state Senate, which for years allied itself with the GOP.

“They convinced a lot of people that Klein was a Republican,” said Bronx Assemblyman Jeff Dinowitz, a Klein supporter.

Klein’s campaign spent $2.4 million as of a filing 11 days before Thursday’s election.

There was another $900,000 left as of that date, making it likely Klein’s final tally will exceed $3 million — more than Cynthia Nixon spent in her unsuccessful run for governor.