The roaming dog – whose owner was not nearby – then bit the child on her face, inflicting the serious wound.
The girl’s grandmother fought the animal off, causing it to flee from the area.
Police said the girl was then taken to Glasgow’s Queen Elizabeth University Hospital for treatment to the facial injury. Medical staff have described her condition as “stable”.
The dog is described as possibly being a black Labrador cross, which was groomed and appeared well looked after. It may have suffered injuries when the woman fought it off.
Police are appealing for witnesses to the 10am attack to come forward.
Constable David Murdoch, of Troon police office, said: “A young girl has been seriously injured by a dog which was off its lead and not the in the presence of any owner.
“I would appeal to anyone who either witnessed the incident or has seen a black dog in the area of Troon beach on Saturday morning to get in contact with police officers.”
Anyone with information can contact police on the 101 number. Alternatively, the Crimestoppers charity can be reached on 0800 555 111, where information can be given in confidence.