If you are going to study in Sweden for longer than three months, you must have a residence permit. Your application should be finalised before entering Sweden. If you will be studying for less than three months, you will instead need a visa unless you’re exempted from the visa requirement for entry into Sweden.
You can submit an online application through the link below.
https://www.migrationsverket.se/English/Private-individuals/Studying-in-Sweden.html
Sweden has diplomatic relations with almost all states in the world, with embassies and consulates in around half of these. Sweden's foreign representation consists of approximately 100 missions abroad and 350 honorary consulates.