There are currently no courses where you can study for a pentest. But a bachelor's degree in Cyber Security or a master's degree in Information Security Technology is a good starting point. There are also a number of certifications for pentesting and information security. Experience shows that most pentesters started in the profession because they are curious by nature and do a lot of research and figuring things out for themselves (intrinsic motivation). There are online free trainings that people can follow to get the “feel” (HTB/tryhackme). And then gain experience at specialized Cybersecurity companies, such as Securify.