At around 2.50pm yesterday, the girl was approached by a man when she was walking through the alleyway off The Tynings close to Corsham School.
The man grabbed her and pushed her against the fence but the victim was able to break free and ran off towards Grove Road.
The man is believed to have fled in the opposite direction, back towards The Tynings.
Detective Sergeant Mel Wilson, of Wiltshire Police, said: “Thankfully, the young girl was not injured during the incident but was left understandably shaken by what happened.
“We are appealing for anyone who was in that area of Corsham yesterday afternoon and either witnessed anything suspicious, or believes they recognise the description of the suspect to call us."
“Please be reassured that we are taking this incident seriously and officers will be carrying out detailed enquiries in the town over the coming days.”
Inspector James Brain, from the local Community Policing Team, added: “Our local officers will also be carrying out increased patrols in the town, to both assist with enquiries and also provide reassurance for local people.
“I would urge anyone with information about this incident to please come forward and help us with this investigation.”
The man is described as white, between 40 and 60 years old, wearing a navy t-shirt, brown shorts, a navy baseball cap and black sunglasses.
To help, call 101, quoting crime reference 54210087179. Alternatively you can call Crimestoppers anonymously on 0800 555111.