Dog poop is high in nitrogen and harm many garden plants. It can also harbor parasites, so it should never be allowed near vegetables that are to be eaten raw. If you would like to use dog poop as a fertilizer for your garden, it needs to be composted first. For these reasons, and others, it is best to train your dogs to stay out of the garden.
Go outside with your dog when he is out in the yard. If he starts to go into the garden, tell him "No" in a firm voice.
Take your dog by the collar and lead her away from the garden. If you believe she needs to poop, lead her to the area that you want her to use as her bathroom spot and give her your chosen command, such as "go potty."
Tell him he is a good boy with enthusiasm when he poops in the correct spot. Show him affection and give him a treat.
Continue going outside with your dog every time she goes out until you are confident that she has been trained where the acceptable pooping spot is, or you are confident she is fully trained to stay out of the garden.
Remain consistent with your no garden rule all year long. If you allow the dog to go into the garden in the fall after the plants are done growing and the garden is full of weeds, the lessons taught in training are lost.
Put fences around the gardens to keep the dogs out if you are not successful with your training. Water sprinklers set to go off from motion can also work as a deterrent to keep dogs out of the garden, unless your dogs enjoy playing in the water.