The blaze broke out on Tuesday morning and 700 people in the vicinity were evacuated, including 500 from the high school next door.
According to police, staff had placed several lice-infested mattresses in the hostel’s sauna in an attempt to delouse them.
However, the mattresses soon caught fire.
“I don’t know who came up with this splendid idea,” said Göran Callervik of Stockholm police to Expressen newspaper.
The blaze was extinguished within an hour, and no one was hurt.
According to Callervik, it was pure luck that the fire didn’t result in any casualties or widespread damage considering the hostel’s proximity to the school.
“It could have been really insane,” he told the newspaper.
Rescue workers spent the early afternoon ventilating the area and ensuring the thick smoke did not spread.
“We’re now carrying out a forensic investigation. We don’t know the extent of the smoke damage and therefore can’t say when the space can be used again,” firefighter Lars Lindberg told the TT news agency.
Police are also looking into whether a possible crime was committed in connection with the misguided mattress cleaning.
The incident could be a case for gross negligence, according to Callervik, which can result in fines or up to two years in prison.