A New York state judge on Friday upheld an upstate community's ban on gas drilling, marking the second victory this week for opponents of the drilling method known as fracking.