This afternoon, it will be checkmate for the school-bus strikers. The strike essentially ends — thanks to the Bloomberg gambit.

The mayor played it perfectly, and willingly sacrificed pieces to achieve his endgame.

At midday today, the Office of Pupil Transportation will open the bid packages for the K-12 school-bus routes. It can start service under the new contracts before September — though not as soon as parents hope, since the contracts must go through the city’s lengthy review process. Still, those bids are what the strike was supposed to stop.

But yesterday, in a bid to be competitive, several bus companies went to court to void the employee protections in current contracts and to halt the new bids.

If that suit fails, a mix of new and currently-contracted bus companies will likely win contracts. Meanwhile, a number of bus companies with current contracts will probably decline to submit bids, because their union contracts would leave them uncompetitive. Their unionized employees, now on strike, would be out of jobs as of June 30.

For these workers, the only rational decision will be to return to work. Already in the last few days, workers have crossed union picket lines to return to their jobs.

After today (assuming the bus companies’ suit fails), it will make sense for more striking drivers and attendants to return for their last few months of pay and benefits, especially their health-care coverage. And it makes even more sense for these workers to seek work with the new companies.

In a sense, the worker-protection bubble finally burst. Small bus companies and their workers are collateral victims; the worker protections put those companies, already operating on a slim margin, at a competitive disadvantage.

When the city, citing court rulings, put out for bid new bus contracts that didn’t require the employee protections (as these contracts had for 35 years), that didn’t mean the bus companies could break their contracts with the unions to provide those priveleges. That left them handicapped in bidding, since they’d have higher labor costs than firms without the generous protections.

To stay competitive, the companies needed the union to work with them to lower costs. But the union instead went on strike — trying to force Bloomberg to retain the protections, and even to get the state to pass a new law to undo the court ruling.

When the National Labor Relations Board this month failed to force even a temporary resolution favorable to the union, the end was in sight.

Mind you, Mayor Bloomberg sacrificed a number of chess pieces to achieve his endgame.

Parents, especially of special-needs children, are angry at him for four weeks of educational disruption. The stress on special-needs kids is incalculable. The city schools lose federal funding for students who couldn’t attend during the strike.

Bloomberg alienated the bus company operators — who feel caught in the middle of the dispute — by not paying them for service they didn’t (couldn’t) deliver during the strike.

Finally, after more than a decade of fairly good labor relations, he will be remembered for breaking one union’s hold on an industry.

Bloomberg’s bold gambit will benefit his successors, who won’t be saddled with needlessly high school-busing costs.

If the city’s lucky, the mayor in his final months in office will use similar gambits to tackle some of the much larger union-benefit issues that are consuming ever-larger chunks of the municipal budget.