So in terms of university courses, you'd most likely want to choose some kind of engineering course. There are lots to choose from, depending on what exactly you want to study. Mechanical or Aerospace would be two good choices to start looking at, or you can even do specific Motorsport engineering courses at some universities if you're 100% set on a motorsport career. Regardless, just reading through the courses structures will give you a good flavour of the kind of things that will be covered.
Other than the course, it would be useful to do some research into which particular area or areas interest you most. There are lots of areas that make up an F1 team: race engineering, design engineering, aerodynamics, vehicle dynamics, strategy etc. and each has a different set of requirements and skills, so understanding which parts you'd like to focus on will help you to choose courses, choose modules within a course and ultimately guide what you spend your time on. Of course ,there is also no need to get too specific too early, you can have more than one area of motorsport engineering that interests you, and there's definitely no need to pigeonhole yourself into just one area before you've even got to university.
Finally, one of the best things you can do while at university is getting involved in a club or society that requires teamwork to work towards some sort of collective objective. Formula Student is the obvious one, as this is great experience of both working within a team and working on a motorsport project, but there are plenty of other options that can also work. It doesn't just have to be a university team either, if you can manage to get work experience in a real motorsport team that will really give you a boost.