All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The view that we adopt here in Islamweb is that the prayer in the mosque is not obligatory and that establishing a congregation at any place fulfills the obligation.
Therefore, you are not obliged to go to the mosque. We advise you not to violate the law of the school and its system so as not to be a reason for others to evade the system, and so that you do not subject yourself to questioning, and possibly to harm.
You can pray with your brothers at school and you are not sinful for this, Allah willing.
For more benefit, please refer to Fatwa 91186.
Allah Knows best.