The seven-year-old was approached by a man at around 5.45pm on Friday in the Minories Road area of Tidworth, west of Andover.
He went with her to a park nearby and then hit her, Wiltshire Police said.
The girl did not suffer injuries but she ran home and was not followed by the man.
Police said the man was around 6ft, thin, aged between 18 and 25 and dressed in a black hat, black trousers and black t-shirt.
Det Sgt Nick Bailey said: “This incident is understandably distressing for this little girl and we keen to speak to anyone who has any information regarding this matter.
“As soon as the incident was reported to us, we conducted a search of the area and a number of house to house enquiries.
“At this stage, it appears the man was not known to the girl.
“Incidents such as these are rare in our county but we would urge the public to remain vigilant and report anything they consider to be suspicious to us.
“Our enquiries are continuing and we’re keen to speak to anyone who was in the Minories Road area of Tidworth… who might have seen something they think could be related to this incident.”
Anyone with information should call 101 and quote log number 297 of 11 August.