A state judge today put a cork in City Hall’s plans to ban Big Apple restaurants and other venues from selling large sugary drinks — a bubble-bursting defeat for Mayor Bloomberg, who has made public health a cornerstone of his tenure.

Before the stunning ruling by New York Supreme Court Judge Milton Tingling, restaurants, movie theaters, sports venues, convenience stores and other places regulated by the city’s health department would have been prohibited — starting tomorrow — from selling sugary drinks of more than 16 ounces.

Judge Halts Bloomberg Soda Ban by New York Post

Tingling permanently stopped the city from enforcing the ban.

“[The city] is enjoined and permanently restrained from implementing or enforcing the new regulations,” Judge Tingling ruled.

Bloomberg vowed to appeal. The mayor grew testy when asked if he had wisely spent so much political capital on the soda ban.

“I got to defend my children and you and everybody else and do what’s right to save lives,” he angrily said. “Obesity kills. There’s just no question about it.”

The mayor said 70,000 Americans and 5,000 New Yorkers will die from obesity-related illnesses this year, making the ban on large sugary drinks a key move.

“This is not a political capital thing,” Bloomberg said. “This is just one human being to another. This is what we got to do.”

Judge Tingling said Bloomberg and the Board of Health overstepped their bounds, to enforce rules that should be established by the legislative bodies.

“The rule would not only violate the separation of powers doctrine, it would eviscerate it,” Tingling wrote. “Such an evisceration has the potential to be more troubling than sugar sweetened drinks.”

Tingling sided with a coalition of store keepers, unions, theater owners and beverage sellers who have been fighting Bloomberg’s ban that was set to go into effect tomorrow.

“It is arbitrary and capricious because it applies to some but not all food establishments in the city, it excludes other beverages that have significantly higher concentrations of sugar sweeteners and/or calories on suspect grounds, and the loopholes inherent in the rule, including but not limited to no limitations on refills, defeat and/or serve to gut the purpose of the rule,” Tingling wrote.

The regulations are “fraught with arbitrary and capricious consequences,” the judge wrote.

Tingling was particularly miffed with the sliding standard of who would be covered by the ban and not.

For example, supermarkets and large chain stores don’t fall under city regulations and wouldn’t have been impacted by the ban. But local, mom-and-pop bodegas would have been forced to adhere to the 16-ounce ban.

“The simple reading of the rule leads to the earlier acknowledged uneven enforcement even within a particular city block, much less the city as a whole … the loopholes in this rule effectively defeat the state purpose of the rule,” the judge said.

Tingling said this public-health debate should clearly be in the hands of lawmakers like the City Council or state legislature. Those bodies have never refused to take up this weighty matter, the judge said.

“There is no rational argument purporting to demonstrate legislative inaction in this area,” Tingling wrote.

“Addressing the obesity issue as it related to sugar-sweetened drinks, or sugary drinks, is the subject of past and ongoing debate with the city and state legislatures.”

Bloomberg said he was completely confident the city will win on appeal.

“We’re going to appeal, we believe the judge’s decision was clearly in error. We will clearly prevail on appeal,” he said. “We think the judge is totally in error and we are very confident we’ll win on appeal.”

Additional reporting by David K. Li