The judge said allowing transgender women to play in female sports creates additional risk of injury and potential liability.