It is a dog’s natural instinct to dig, it stimulates them it tires them, and it is good exercise.
Some dogs dig a hole to lay in because it helps to cool them down. Always ensure that your dog has a cool place to rest during the day to help prevent them from digging holes if that is the reason why they are digging.
If you do not want your dog to dig out your entire garden there are a lot of other ways you can stimulate their need to dig.
Dedicate one spot in your garden for digging you can through some of your dog’s treats in the sand and let your dog scratch it out soon your dog will learn that they can dig there. If you do not want to do that you can buy a plastic shell at most plastic stores and play sand and teach your dog to dig in there the same way mentioned above. The nice thing about the shell is you can either use it for sand and in the summer, you can put water in it for some water play and for your dog to cool off.