Peter Milburn seized the youngster “aggressively” and sent him sprawling to the ground at the world-renowned attraction.
The 70-year-old accused the little boy of soaking his family, including his grandchild who was in a pram.
Milburn appeared at the city’s sheriff court on Monday and admitted a charge of assault.
But he was admonished by Sheriff Peter McCormack who said the incident likely wouldn’t have occurred if the child had been under parental supervision.
Fiscal depute Janet MacDonald said the boy had been with his mum and her friend on a visit.
Ms MacDonald said the child was playing with a sprinkler along with other children “in order to soak one another”.
She said a path area was “getting wet” and people were walking on the grass to avoid the water.
The prosecutor said Milburn approached the boy, who was holding a sprinkler, and grabbed his right arm around the front before “aggressively pushing him to the ground”.
The boy’s mother ran over, the court heard, and told Milburn: “You just assaulted my little boy. He’s four.”
Ms MacDonald said Milburn replied that the youngster had “splashed him and his family with water”.
She said the boy “fled” the area and was “upset and crying”.
She added: “Numerous people then got involved to stop the accused and his family from leaving. The accused began to walk away and was told the police had been contacted.
“The accused said, “Alright, apology”, in a sarcastic tone.”
Cautioned and arrested by police officers, the court heard Milburn replied: “What will be will be”.
Defence agent Joe Boyd said Milburn lives in Macclesfield, Cheshire, with his wife and had been visiting Edinburgh on July 26 2019 when the incident took place.
They were on a family visit to the gardens when they ended up getting “considerably wet” from the sprinkler, Mr Boyd said.
He added: “This came out of the blue for my client. He didn’t see it coming. It caused particular distress to his baby grandchild in a pram.”
Mr Boyd said Milburn believed the youngster, who was unsupervised at the time, would continue to “fire” at his family and he wanted to “stop the onslaught of water”.
He added: “What happened after that was very unfortunate. It wasn’t his intention when he set out to cause any harm to the child”.
The court was told Milburn had suffered “considerable mental health difficulties” due to having the case hanging over him.
Sheriff McCormack said it was an “unusual case with an unusual locus (location) and an unusual age gap between the complainer and accused”.
Admonishing Milburn, the sheriff said more parental supervision of the boy could’ve prevented the whole incident from occurring.