A judge has granted local selectmen the authority to hold a special town meeting to allow residents to decide if they want to spend nearly 900,000 to buy a former medical office building in the heart of the newly renovated downtown and repurpose it to create new municipal office space.