Roman Putnoky was arrested after police received reports of a disturbance on Woodview Road, Beeston, on February 10 last year.
Leeds Crown Court heard the officers went to the area and saw the 31-year-old defendant near a street corner.
Robert Galley, prosecuting, said Putnoky had his hands in his pocket and the officers told him to show them his hands.
Putnoky then ran to nearby Upper Woodview Place.
An officer who gave chase found a cheese knife in the street and hid it from sight while she continued the pursuit.
The defendant was detained and arrested in the kitchen of a house.
When asked about the weapon during an interview, Putnoky replied: "I thought it was a fake."
Putnoky, of Upper Woodview Place, pleaded guilty to possessing a bladed article in public.
He has no previous convictions.
A report stated Putnoky had been diagnosed with schizophrenia and is now on medication for the condition.
He also has the support of his family.
Judge Robin Mairs agreed to impose a community-based punishment so Putnoky can continue to receive treatment.
He was made the subject of an 18-month community order and told he must complete 20 rehabilitation activity requirement days.
Judge Mairs said: "The police responded to you screaming and waving a knife in the street.
"That would have been terrifying for anyone in the street and for passersby."