A federal judge dismissed a lawsuit last week that challenged the city’s restrictions on natural gas in new low-rise residential buildings, a major boost for local governments looking to follow suit.