The overnight destruction of St Louis Secondary School, Dundalk was prevented by a member of the public who raised the alarm and the swift response of the Co Louth Fire and Rescue service.
A 1950's building in the school complex on the Castletown Road was completely gutted by the blaze.
Four fire tenders from Dundalk and Ardee managed to stop the fire from spreading to the rest of the school complex.
Paddy Agnew, a Dundalk-based Fire and Rescue station officer, said a passer-by noticed the blaze and raised the alarm at 3am.
He said: "When the crews got here, the fire was well-developed in the timber-construction building of approximately 100 ft by 50ft and the challenge was to stop it from spreading to the main school area."
The Acting School Principal, Michelle Dolan, said: "We are indebted to the work done by fire crews and we hope to be able to open, as usual, on Monday morning."
She also said that school staff were conscious of the Leaving Cert and Junior Cert students preparing for exams.
We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences
Over 500 students attend the all-girls school, built in spacious grounds a mile from Dundalk centre.
Gardaí have sealed off the fire scene as examination of the site continues.
The cause of the blaze has not yet been identified but one of the theories being explored is that an electrical fault had a role in the fire.

We need your consent to load this Facebook contentWe use Facebook to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences
(Video: Ronan Curtis)