Kaylin Darrell turned, ran and jumped over a waist-high fence, after spotting the officers on Beechwood Close, just after midnight, on May 6 last year, said prosecutor Tom Heath.
As he fled, he dropped a red shopping bag in the car park of the Forest Tavern, and was caught with £300 in cash.
The bag contained a large serrated hunting knife, as well as scales, cocaine valued at £2,720, and £770 of heroin.
He told officers he was only a courier and had been delivering the bag after racking up cannabis debts.
He said he'd been holding the bag for a fortnight, and hid it up a tree, but wouldn't disclose the names of anyone else.
Simon Eckersley, mitigating, said Darrell had no previous convictions and was the sole carer for his son.
“He was a facilitator, but didn't sell drugs directly to people on the streets," he said.
Darrell, 26, of Radford Road, Nottingham, admitted possession of the class A drugs and an offensive weapon, at Mansfield Magistrates Court, on September 14.
Judge Mark Watson told the defendant he was acting on instructions which "came from criminal elements much further up the chain."
"People who deal in class A drugs almost inevitably find themselves going to prison," he said. "It's why people like you are chosen to take the fall. You put your own safety and liberty at jeopardy."
On Friday, he sentenced Darrell to two years, suspended for 18 months, with ten rehabilitation days and 150 hours of unpaid work.