The city’s limit on the size of sugary drinks is an “extraordinary infringement” on consumer choice, a lawyer for the American Beverage Association and other critics said in court on Wednesday.

“New Yorkers do not want to be told what to drink,” attorney James Brandt told Manhattan state Supreme Court Justice Milton Tingling.

The city Health Department’s chief lawyer, Thomas Merrill, told the judge that the limit is reasonable and needed, and the health board had the authority to enact it.

“The reason for the rule is that there is an obesity epidemic,” and scientific evidence show sugary drinks are playing a big role, he said. “A product that contains empty calories and no nutritional value is being over-consumed.”

Opponents also are raising questions of racial fairness alongside other complaints as the novel restriction faces a court test.

The NAACP’s New York state branch and the Hispanic Federation have joined beverage makers and sellers in trying to stop the rule from taking effect March 12. Critics are attacking what they call an inconsistent and undemocratic regulation, while city officials and health experts defend it as a pioneering and proper move to fight obesity.