In doing so, the judge turned back a challenge from the New York State Restaurant Association, a voice for the food service industry.
"It seems reasonable to expect that some consumers will use the information disclosed ... to select lower calorie meals ... and these choices will lead to a lower incidence of obesity," U.S. District Judge Richard Holwell said.
The city's Department of Health and Mental Hygiene believes the regulation will prevent 130,000 New Yorkers from becoming obese and will stop another 30,000 from developing diabetes over the next five years.
"We just want people to have the information available to them to make healthful decisions," said health department spokeswoman Jessica Scaperotti.
The new law, which takes effect next Monday, applies to restaurants with more than 15 outlets across the country. That includes fast-food places like McDonald's and such sit-down chains as Olive Garden and T.G.I. Friday's.
The city Board of Health voted unanimously in February to approve the regulation, a new version of a rule that had been struck down by a judge last year after a challenge from the restaurant association.
"We don't object to people doing it voluntarily," restaurant association spokesman Chuck Hunt said Wednesday. "Our problem was the government agency forcing them to do it. We think restaurants should be able to determine from their customers how they want to get the information."
Some restaurants including Starbucks and Chipotle have already started to post calories on menus; the rest will have five days to comply with the law. The health department said it will not start fining restaurants until June 3.
New York City, which banned trans-fat-laden cooking oils from all restaurants last year, is believed to be the first U.S. city to enact a regulation requiring calories on menus.
Since then, California lawmakers and those in King County in Washington, which includes Seattle, have considered similar bills.