Benjamin Manirambona was also banned from teaching or holding any public office for 10 years.
Plain-clothes policemen arrested him on Friday in Burundi after acting on a tip-off as he took the exam in a school uniform.
The officers had staked out the school overnight, waiting to catch him.
With nowhere to run, Manirambona, the head of Butere Technical College in the capital Bujumbura, admitted to the deception on the spot.
He explained he was taking the electronics exam on behalf of a soldier who is serving in Somalia at part of a Burundian peacekeeping force.
He said the student wanted the grades to qualify for university.
The soldier promised him a payment on his return to Burundi, Manirambona added.
Burundi’s Education Minister Janvière Ndirahisha, who arrived at the scene on Friday with uniformed officers, dismissed Manirambona’s explanation.
“Everything you’re saying is a lie, so we’re taking you away… we’re going to investigate because from what we hear it’s not the first time [you’ve done this],” she told him.
His two accomplices, school accountant Eric Nkurunziza and teacher Lazard Nihezagire, have been given prison sentences of two years each and have been banned from holding any public office for five years.
The two were found guilty of covering up for the headmaster.