The 17-year-old, who cannot be named for legal reasons , appeared from custody after he admitted behaving in a threatening or abusive behaviour causing fear and alarm.
A judge sent him back to detention for a year, adding he was hopeful he will become a useful member of society.
The teen shouted, swore and brandished the blade in the town’s Woodcroft Avenue on April 3 last year before pursuing the other male with the weapon.
He then repeatedly struck a car with the knife.
At the time the teen was the subject of a bail order granted on March 2, 2022 at Glasgow Sheriff Court.
During the Kilmarnock Sheriff Court hearing, which was closed to the rest of the public because of the accused’s age, defence solicitor Donna Maitland said: “I speak to [the accused] frequently and he comes across as a thoroughly decent young man, notwithstanding the offence.
“He has been remanded since August. He accepts custody is inevitable.”
Ordering the teen to be detained for 12 months, Sheriff Alistair Watson said: “I think the fairest way to deal with this from you is to impose a sentence today.
“It will be custody. No alternative is appropriate as the offence does involve a knife and you being on bail at the time.
“Having said that I do have regard to your very young age. The [social work] report is very positive and does give me hope.
“You have potential to go on to be a useful member of society.”
The teenager, whose address was listed as the Good Shepherd Centre in Bishopton, Renfrew, replied “thank you, your honour” as he was sentenced.