A California judge threw out a legal challenge to a controversial policy enacted in 2018 by…