A federal judge has ruled against the Trump administration's decision to end a program protecting some young immigrants from deportation.