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.
First of all, we ask Allah to safeguard you and protect you from the temptations, both what is apparent of them and what is concealed, and enable you to become a young man who grows up in the worship of Allah, and we ask Him to shade you under His Shade on the Day of Judgment, when there is no shade but His.
Obedience to parents, even though it is an obligation in principle, is restricted by certain conditions, among which is that there should be no harm on the child. When there is harm on the child, obedience is not obligatory in this case because it is not within what is good and reasonable.
‘Ali narrated that he heard the Prophet say, "There is no obedience (to any human being) if it involves disobeying Allah; obedience is only in that which is right and proper." [Al-Bukhari and Muslim]
For more benefit, please refer to fatwa 84942 and 131695.
We advise you to be kind and gentle with your parents and try to persuade them while seeking the help of Allah and supplicating Him to enable you to do this. You may also seek the help of people whom you think will persuade them and to whom they would listen and who would clarify to your parents that there is no need to insist on continuing in this school while there are suitable alternatives. If they are convinced, then praise be to Allah; otherwise, being safe in one’s religion takes priority.
However, we do not advise you to totally abandon studies or to hasten to leave this school, especially if it would cause your parents financial and legal consequences, as you mentioned, as this is not permissible. Rather, you should do what preserves your religion and at the same time pleases your parents and spares them such inconvenience; especially that sinning is avoidable if you beware of it and avoid what leads to it, such as forbidden looking and being in seclusion with women, and so on.
Allah knows best.