The National Education Association, the nation’s largest public-employee union, endorsed Hillary Clinton for president on Saturday. That’s on the heels of the endorsement by another giant, the American Federation of Teachers. These are powerful allies, but in the future, they may have a lot less money to spend tilting elections for Dems.

The US Supreme Court, which began its term Monday, will rule on whether public workers in unionized jobs can be compelled to pay the union for collective bargaining and other services even if they don’t join. Labor activists are petrified.

A decision nixing mandatory fees would have its biggest impact here in New York, where nearly three quarters of government jobs are unionized. Teachers, firefighters, sanitation workers and others could stop paying dues, drying up union coffers. New Jersey, Illinois, Connecticut and California public-sector unions would also be hit hard. “Bush v. Gore decided a single election,” a union supporter warns, but this case “could decide elections for years to come.”

Just look at Wisconsin, where Gov. Scott Walker was determined to tame union political clout. His legislature released government workers from paying union dues even though they benefit from union negotiating. Union rolls plummeted by more than one-third in two years.

Yet that could soon happen in many other states without legislative action if the Supreme Court rules for a band of Orange County, Calif., teachers in Friedrichs v. California Teachers Association.

“I am opposed to forced fees and forced unionism,” says Rebecca Friedrichs. She and other teachers are challenging a California law that compels public workers in unionized jobs to pay a “fair share” fee (same amount as dues) in return for representation, if they don’t actually join. True, the law allows them to “opt out” of the union’s political activities and get a fraction of the money back. But the onus is on workers to apply for the opt-out every year. Most don’t get around to it. Inertia is on the side of the union.

The California teachers claim it’s a First Amendment issue. Money is speech. Teachers pay $174 million a year to support the California Teachers Association, even though many oppose the union’s left-wing positions and endorsements. The teachers’ lawyer blasts the current law as “a multi-hundred-million-dollar regime of compelled speech.”

That’s the way it is in 22 other states, including New York. Virtually all (98 percent) of AFT contributions to federal candidates go to Democrats. But a quarter of state and local employees are Republicans, and another 30 percent are independents.

The Supreme Court justices are bitterly divided over forced union fees. Justice Elena Kagan, a strident union fan, insists the Court has no business overturning the longstanding opt-out arrangement. But Justice Samuel Alito has signaled he wants to liberate public workers who disagree with their unions. So do three other conservative justices. But five votes are needed to overturn the current system.

Justice Antonin Scalia is the wild card. Though generally conservative, in past cases he opposed allowing public workers to benefit from collective bargaining without paying for it.

The prospect of Scalia turning and providing the fifth vote has union advocates quaking. It’s “an insidious way to bankrupt unions,” says Fredrick Kowal, union president at the State University of New York. “It may well be life or death for the unions,” warns Harvard Law’s Benjamin Sachs.

Left-wingers are sounding the class-warfare alarm, urging the court to protect union clout for the little guy.

But it’s precisely the little guys — the hardworking taxpayers — who suffer from the inflated cost of government. Thanks to over-the-top demands of public unions and the Democratic Party that eats at their table.

The justices’ duty isn’t to protect union fees. It’s to safeguard individual rights. As Thomas Jefferson warned, “to compel a man to furnish contributions of money for the propagation of opinions which he disbelieves and abhors, is sinful and tyrannical.” It’s also unconstitutional.

Betsy McCaughey is a senior fellow at the London Center for Policy Research.