"A Boy's Best Friend" is a science fiction short story by American writer Isaac Asimov, published in 1975. It has been collected in The Complete Robot and first appeared in Boys' Life, March 1975.
A Boy's Best Friend Wikipedia
This story is set far in the future when habitation of the Moon has already taken place. Jimmy Anderson is a Moon-born ten-year-old, and he owns a robotic dog named Robutt, whom he comes to love. He can go on the moon freely and securely as he is moon born and has Robutt with him. However, his parents want him to have a real dog, a Scottish Terrier. Since Moon-borns cannot visit Earth, his parents bring the dog to the Moon. But since the relationship between Jimmy and Robutt is so close, Jimmy decides not to have the 'living' dog and keep the 'fake' dog Robutt instead.
Quoting Asimov himself, "you may find in it (the story) a distant echo of Robbie". That story, written 35 years before, also involves a relationship between a child and a robot.