The question how to dress when you work at a university is raised by many but answered by few. The main issue I think is what to wear during a lecture. There is no recommended dress code in Sweden but maybe an implicit one.
When I am the main speaker of a lecture at the univesity or when I am asked to give a guest lecture elsewhere I usually dress in one of two ways.
1. Dark pants with a press fold, a t-shirt and a blazer that is matched with either the pants or the t-shirt.
2. Blue jeans, a shirt and a blazer.
Both alternatives looks nice but are semi casual. Not too strict. Not too stylish or handsome attire. Not too ordinary.
Denim is usually for workers but it is also looking very good in a lot of situations for an academic.
Even if you aren't scheduled to meet students they might show up anyway. That leads me to choose a similar attire as above every day at office.
I also want to look rather good when I attend meetings with co-workers, with my boss or with guests from other universities.
You don't have to dress up but try to always look good when you are at work.
At home I seldom use pants with a press fold or a blazer. I has happened but it is unusual. My typical clothing is jeans and a t-shirt. Sometimes a cardigan.
As a relaxed Swede it is more important to stay relaxed in all situations. That is why I don't wear a tie, a bow tie or a suit. I would never wear, at any occasion, a tuxedo.
If you are looking for a dress code at the workplace in sweden it looks a bit different depending on profession. It can be more casual within the university sector compared to the business sector. In the business sector you are expected to dress more conservatively.
Swedes like fashion. Especially in the big city regions. They like to wear good lookinig clothinigs in public. That includes the workplace. At the same time Sweden is known for being more casual than other European countries. To be on the safe side, though, you should not dress down.
If you work at the university your co-workers will never complain as long as you're don't wearing torn clothes or dirty clothes. Besides that you are rather free to choose for yourself.