The 17-year-old and other youths were confronted by a police officer while chatting peacefully in a south west London shopping centre on their way home from school.
MB, who cannot be named for legal reasons, was prosecuted at Wimbledon Youth Court last September for failing to comply with the direction.
But yesterday his conviction was overturned by two senior high court judges who said the police officer's direction was not 'a proportionate response'.
In a decision which will be welcomed by civil liberties campaigners, the judges declared there had been 'an illegitmate intrusion into the rights of people to go where they please in public'.
Lord Justice May, sitting with Mr Justice Aikens, said the evidence before the youth court was that MB and his group 'seemed well behaved' and were not blocking doorways as they passed through Wimbledon train station and the Centre Court shopping centre.
But the beat officer - knowing that there had been a trend for youths from several of the local schools to meet in the vicinity and start fights - made the dispersal direction using powers under the 2003 Anti-Social Behaviour Act.
Provisions of the Act allow the police to clamp down when they have 'reasonable grounds' for suspecting that anti-social behaviour could cause members of the public to be 'intimidated, harassed, alarmed or distresed'.
The youth court ruled that the officer in MB's case had reasonable grounds for making a direction because of his previous experience of youths loitering in the area.
MB was found guilty of contravening the direction and sentenced to a 12-month conditional discharge and ordered to pay costs of£50.
Overturning the conviction, Lord Justice May warned police officers that it was not enough, save in exceptional circumstances, to rely solely on past experience.
There had to be 'some behaviour on the part of the group' at which the direction was aimed to justify the direction being made.
Otherwise, as the MB case illustrated, 'it would intrude on the legitimate activities of young people coming from school by a particular route, behaving properly as they do so.'
The judge said he had some sympathy for police officers 'having to operate what at the margins is difficult legislation'.
But the way MB and the other youths were acting at five o'clock in the afternoon of an early summer's day was not capable, objectively, of giving rising to the necessary reasonable belief that harrassment or intimidation would be caused.
STRAND NEWS SERVICE