Regulations allowing men in women’s spaces ‘are the result of arbitrary and capricious agency action,’ judge says.