Drew Todd drove off in the Citreon C3 after officers indicated they wanted to speak to him, on Stanton Hill, at 9am, on June 5.
He tried to flee because he had been banned for dangerous driving, in November 2016, but he was stopped and cocaine was found on him at the police station, said prosecutor Robert Carr.
Todd, 18, of Pepper Street, admitted possession of the Class A drug, driving while disqualified and failing to stop when he appeared at Mansfield Magistrates Court, on Thursday.
Probation officer Cheryl Nisbet said Todd, who drove at speed, U-turned and ran red lights, had been “showing off in front of his friends” during the previous offence.
“The police dog had to be deployed when they were eventually stopped and he tested positively for cocaine,” she said.
Yvonne Wragg, mitigating, said Todd was a “young man with a great deal to cope with.”
“Since the age of ten he has been his mother’s full-time carer,” she said.
“She has severe mental health issues. He has had to cope with going to school, passing his GCSEs and returning home.”
District judge Andrew Meachin said: “The reality is I can find no reason not to activate the suspended sentence.”
He activated half of the suspended sentence of 26 weeks, and added eight weeks for the driving offences and four weeks for the drugs, jailing Todd for a total of 25 weeks.
He must also pay a £115 victim surcharge.