Many dog owners do their best to train their pets to stop digging holes in the backyard.

But for one mischievous golden retriever, the naughty habit helped take more than $100,000 worth of black tar heroin off the streets.

Eighteen-month-old Kenyon dug up a mystery object in his family's backyard in Yamhill County in the US state of Oregon.

The family, who have opted to stay anonymous, thought Kenyon may have found a time capsule buried by the home's previous owners, so they filmed themselves opening it for posterity's sake.

Kenyon was also named an honorary narcotics K9 for life. ( Facebook: Yamhill County Sheriff's Office )

But they soon realised it was not a time capsule — and was more likely some sort of controlled substance — and called the police.

Little did Kenyon's owners realise their dog had dug up more than 15 ounces of black tar heroin, worth about $US85,000 ($107,000).

The Yamhill County Sheriff's Office, which identified the substance, praised Kenyon for his backyard discovery.

"Opioid addiction and overdose deaths are on the rise and, with the help of Kenyon, this large quantity of heroin is removed from our community," Sheriff Tim Svenson said.

Mr Svenson presented Kenyon with an official K9 citation ribbon — and he was also named an honorary narcotics K9 for life.