The blaze broke out as pupils visited the Freeston Academy in Normanton to collect their GCSE results.
West Yorkshire Fire Service said it took ten pumps nearly three hours to bring the blaze under control.
A spokesman said: “Firefighters contained the fire to a two-storey annexe which contains IT classrooms on the first floor and a study area on the ground floor.”
An academy statement said: “Our main priority was the safety of our staff, students and contractors working on site, and to ensure that our Year 11 students were able to collect their GCSE results.
“Following advice from the Fire Service, all students were able to collect their GCSE results from outside the Sports Hall.
“All staff on the site were accounted for and no one was hurt in the fire. West Yorkshire Fire Service are now investigating the cause of the fire, and subsequent damage and implications.”