James Stewart, 19 and from Lossiemouth, admitted that he dangerously tailgated and overtook another car on the A941 Elgin to Rothes road close to the Ben Riach distillery junction.
He also admitted that he had been driving without a licence or insurance when committing that offence in December last year, and at an earlier appearance to racially aggravated assault on an employee at the Polish Deli on Commerce Street in Elgin in May of 2013.
Stewart had also admitted an assault at the Buckie Community Centre in April this year, failing to appear at court and threatening behaviour.
The teenager appeared in Elgin Sheriff Court from custody and was ordered to be detained for 257 days to be backdated to his arrest on September 14. He was also disqualified from driving for a year.