Yes if it is purely circadian rhythm issue you can use OTC melatonin tablets. They are safe to use .
also try sleep hygiene which would include following points.
-Go to bed and wake up at the same time every day.
-Create a relaxing bedtime routine to get your body and mind ready to sleep.
-Stop working on any task an hour before bedtime, and avoid talking about stressful or emotional issues in bed.
-Make your bedroom dark, quiet, cool, and comfortable. Use earplugs or a sleep mask if you need to.
-Skip caffeinated beverages within 6 to 8 hours of bedtime.
But the way your sleep quality is being affected you should also get ruled out depressive episode by meeting a psychiatrist where discussion about other symptoms can take place. In that case you might require cbt or ssri course. You can do so after 3 days trial of melatonin as well.
All the best for exams, take care 🙂
Next Steps
sleep hygiene and psychiatric consultation to rule out depression or other psychopathology