Is your Dog trying to get to China through the back yard?
Dogs usually dig out of boredom. Years ago when dogs where in the wild, they used to dig to stay cool and make a bed for which to lie in. Chances are, that is not the case with your dog since dogs have become more much domesticated and settled since then. They will dig holes to escape when they feel frustrated or they are bursting with energy and have no where to release it. They will also dig when they are lonely since dogs are very social animals.
If you have a digger and have tried everything, check with your vet. There are mood-altering drugs for the extreme cases to stabilize their emotions. Also communicate with your dog by telling him that you have found him a nice place to dig and don't scold him for not digging in the previous spot. Dogs would rather go by your praise then listen to what you don't want them to do. Spend more time together, by doing so, your dog will not have the time to be bored.
Dogs will also dig and eat the soil if they aren't getting the proper nutrients in their diet. If this is the case, make sure you give them a multi-supplement. You can tell if they are eating the dirt (called pica) or not by their nose being covered with dirt. Usually the underlying case is anemia, but make sure you have them checked by a veterinarian to make sure. A Dog can also get serious bacterial infections from dirt. And the digging and constant abrasions to their nose can cause cancer over a period of time, if left to continue digging holes.
One of the best ways to prevent any of this is by keeping them cool. By keeping them cool, they won't need to bother with the earth as their next choice.