Ryan Slingsby took the seven centimeter-long kitchen knife with him after warning hostel staff about his plans, but he was found by officers at a bus stop on London Road, on May 24, and the knife was found on the floor nearby.
Slingsby, 21, of London Road, Newark, admitted possession of a bladed article when he appeared before magistrates in Mansfield, on Thursday.
He received a three week suspended sentence for theft in December 15, 2016.
Matthew Taylor, mitigating, said: “He never had any intentions of harming anyone. It was a call for help in desperate circumstances.
“He took the knife with the initial intention of harming himself. He had been going through a difficult patch.
“He phoned the hostel and told staff to give his room to someone else.”
Probation officer Cheryl Nisbet said Slingsby had been leading a chaotic lifestyle while he was homeless in Nottingham, but since December had found stable accommodation and was “making good progress.”
“Drug dealers were threatening him to beat him up and that’s why he had the knife,” she said.
He has stopped using the synthetic drug mamba, she added.
Magistrates gave him a six week prison sentence, suspended for 12 months, and a six week curfew, from 7pm to 8am.
The suspended sentence was also extended by six months. He was ordered to pay a £115 victim surcharge.