Appearing before Judge John Brandts-Giesen in the Queenstown District Court on Monday, Smith admitted a charge of entering a building and remaining in it without authority and with intent to commit an imprisonable offence.
Judge Brandts-Giesen said Smith suffered from a major depressive disorder, and "completely lost control" of his emotions as a result of a change of medication and intoxication.
When police arrived at the "ironically named" backpackers, Smith told them he wanted to show people how upset he was about what his girlfriend had done.
He was carrying matches and two fire-lighters, which "spoke volumes" for his intent.
There were 52 people staying in the hostel that night.
Smith was convicted and sentenced to 12 months supervision and 150 hours community work.
He must pay $800 in reparation to both the hostel manager and his former girlfriend.
A protection order has been put in place to shield his former girlfriend.