Sometimes, the fertilizers we're using are inadvertently attracting dogs to our garden. Changing how and when you use fertilizer can be a great way to discourage dogs from getting into your yard.  Dogs react strongly to new smells and odors, and may be put off if a smell suddenly changes. This can signal to them that another animal has potentially infiltrated their space. Switch up with fertilizers you use periodically to make dogs wary of entering your garden. Organic fertilizers are great, but can sometimes contain smells that attract dogs. Look up information on the fertilizer you're using online to see if anyone has had issues with a particular fertilizer in terms of it attracting dogs. Oftentimes, people are tempted to use rabbit or deer repellents in conjunction with fertilizers to keep dogs at bay. The problem is, such repellents often contain coyote urine and this attracts dogs. Avoid such repellents when trying to keep dogs out of your garden. Dogs are likely to return to the same spot if they believe it's dog friendly. When a dog uses your garden as a bathroom, they leave their scent behind and other dogs assume relieving themselves in this space is okay. Clean the area thoroughly after finding dog feces.   Dog's often pee in the same places they defecate. Dog urine can leave burn marks on grass and plants, so douse the area with a hose shortly after removing the feces. This neutralizes the acidity of the urine and lessens its effect on the garden. You can also rake compost into the area, which contains soil organisms that balance soil biology and chemistry. Just be sure to move any compost bags well out of a dog's reach. Throw any fecal matter into a closed dumpster, after sealing it in a plastic bag. You don't want the smell to attract more dogs to the area. Whether home made or store bought, a variety of repellents cause unpleasant smells and sensations that will discourage unwanted dogs from entering your garden.  Garlic, olive oil, and almond oil have been known to keep dogs away when sprinkled on or around plants or in the soil surrounding a garden.  Ammonium and vinegar provide small smells that drive dogs away. Placing ammonium or vinegar soaked cotton balls around the garden, especially in places where dogs have defecated previously, may be effective in keeping pets out.  Oftentimes, home remedies are hit or miss. There are specially made dog repellents, sold online or at pet stores, that are environmentally safe and not harmful to dogs or other animals. Some can be quite expensive, in the $60 to $70 range, while others sell for about $12.  Some sites recommend citrus and cayenne pepper as a deterrent. This should be avoided. Citrus can be potentially harmful to dogs. While not every dog will have a negative reaction to citrus, it has caused health effects for some dogs in the past so it's best to err on the side of caution. Cayenne pepper causes irritation in a dog's face, skin, and paws. You do not want to inadvertently harm your own dog or a neighbor's dog in attempt to keep them out of the garden.

Summary:
Manipulate your choice of fertilizers. Clean the area thoroughly. Use repellents to keep dogs out.