The judge in Hampshire Superior Court said the 10 residents lacked standing to bring the litigation.