The fire broke out just before 2:00 am at the District Office building on Van Ness Avenue and Hayes Street.
Firefighters confined the flames to one office, but there's heavy smoke and water damage to other parts of the building.
Crews closed down Van Ness Avenue in order to fight the fire, and witnesses reported hearing a large explosion about the time it started.
No one is reported hurt in the fire and Van Ness has now reopened. An investigator says it does not appear suspicious, and they are working with the San Francisco Unified School District to find out what was destroyed and the extent of damage.