Owner Chris Morrison had been taking five-year-old black labrador Oscar round the Pitreavie golf course in Dunfermline for several months.
He took Oscar to the vet after noticing a rattling sound coming from his pet's stomach.
They then discovered that 13 golf balls - each weighing 45 grams - were lodged in his stomach. One of the balls had been in his stomach so long that it had turned black and was decomposing.
The balls were removed two weeks ago in a successful hour-long operation.