Welcome to Health Care Magic
The problem you are having like if I will not do a particular thing some thing bad will happen is called as AS-IF phenomenon. It is a part of Obsessive and Compulsive disorder. If you are having this thing, and you are aware that this is your own thought and you are not able to control these type of thoughts, and thoughts are distressing to you, and they persist unless you are compelled to do things according to your thought; then this is OCD.
OCD is a disorder of anxiety
disorder group. If your education and work is hampering due to this then you should visit a psychiatrist
for expert opinion.
Treatment is both medicinal (like SSRI
medicines), non medicinal (Behavior therapy, relaxation techniques
, exposure and response prevention, relaxation techniques etc which you can do at home). If you have any other doubt you can ask again