There is not alternative justification. This guy did not want to follow the school's rule, and went to court to challenge it on religious grounds. The judge ruled against him. Its as simple as that.
Its okay that judge ruled against him, but judge should've simply discarded the application saying something like that it is school's policy and that govt rules don't dictate schools on rules bla bla... but to drag in Talibanisation suggests as if beards = Talibanism.