I did see a very similar question to this but it applied to working visas not student visas, but my situation is that I will be studying in France next year for 5-6 months using a student visa. Can I leave the Schengen zone after the end of my student visa, by travelling through the UK and Ireland and then re-enter the Schengen zone using a tourist visa to travel around France and surrounding countries again (only for three weeks).
Whether it is for studies, for work or for any other purpose, a visa for 5-6 months is almost certainly a national long-stay visa. It means that the rules detailed in Getting a tourist Schengen visa after working visa fully apply to your situation.
Concretely, the time spent under the French long-stay visa does not count towards the 90 days limit for short stays in the Schengen area. If your nationality allows you to visit the Schengen area without a visa, you could therefore leave to the UK and return for three weeks (or even stay in the Schengen area). If you do need a visa, you will need to apply for one before returning to the Schengen area but it should not be refused solely because you already spent too much time there.
Do make sure you get an exit stamp, as it can be useful to prove you did not stay in the Schengen area between the end of your long-stay visa and your next visit.