Within the Foreign Service, there are Generalists and Specialists. The Generalists are what you would typically think of as diplomats, and are on a long-term track towards management. Specialists may go between foreign assignments and at various State Department bureaus in Washington DC, and are more specialized in certain topics. There are also regional experts at the Department here in the US who work as liaisons between the Foreign Service Officers (FSOs) abroad, and upper management/leadership domestically. They are called Desk Officers and are assigned to for example, the Japan Desk, or the Colombia Desk. If you want to be a Foreign Service Officer, it's typical to major in International Affairs, Political Science, or some sort of regional expertise, like Middle Eastern Affairs.
It is extremely beneficial to be proficient in another language, or at minimum to show some talent in language learning. If you'd love to work in China, you should start learning Chinese now. For many countries, you need to learn the language of that country and pass a proficiency test. Those learning a language are taught at the Foreign Service Institute, often in between posts. And often, the higher score you get on the language test, the more money you make. If you don't already have a good foundation in another language, make sure you take language classes throughout your time in college. It should line up with whatever country or region you're most interested in.
Then there is the entrance exam. This exam is notoriously difficult, and many people take it two or three times before passing, if at all. There is a written exam and an interview. The written exam is meant to weed out anyone who doesn't know their American history or hasn't studied regional political affairs. The interview is to test how you would do in different situations - as in, is your personality suited to being diplomatic and representing the United States in any country.
If you're not particularly interested in history, politics, economics, etc, and are more interested in STEM subjects like cybersecurity, you should pursue whatever topic you're most interested in and then look for civilian jobs at the State Department that would allow you to work within the Foreign Service as a specialist instead. Best of luck!