Hi, welcome to HCM. Thanks for asking your query at this forum.
We understand your concern. I have read your question carefully and understood it. I will try my best to answer it.
Although
masturbation is considered to be a safe sexual practice by medical professionals, sometimes habitual masturbation becomes a problem as it happening in your case. If you feel that it has become a compulsory act and you intend to get involve in this act despite inner resistance then you have been addicted to it. I can understand how much
stress it might be causing to you as you feel no control over this habit. It that must be affecting your studies and social performance.
There is therapy available to control the urge to masturbate. You should avoid any stimulating thoughts by avoiding any pornographic material and by avoiding vicinity to any possible sexual partner. You should take less spicy and less oily food, avoid any drug/substance, have a balanced nutritious diet, should do regular yoga/meditation/relaxation exercise, regular physical activity, and enough rest.
Specifically you should try to indulge in some other healthy pleasuring activities like playing games, reading good fictions for some time, listening to soothing/ your favourite music for some time etc. It will provide you an alternative way of pleasure rather than masturbation. You should be more social and avoid privacy to reduce the chances of masturbation.
Ideally you should be benefited with these measure. If you are not getting enough relief then you may require prescription of few psychotropic medicines for a period of time.
You will be fine soon. I hope it answers your query. I wish you all the best.