There is no way to prevent canine diarrhea 100% of the time, and all dogs will experience this condition at some time or another. To avoid diarrhea caused by an illnesses, you should ensure that your pet has had all of his immunizations and avoiding switching to a new food without a slow transition, as this could upset your dog's stomach.
Many times, there is no known reason for canine diarrhea to occur. Dogs may get into scraps or trash, or eat outdoor plants when you aren't watching and these things could upset their stomachs. In cases like these, there is not much an owner can do to prevent the issue, and most of the time it will clear up on its own. You may not discover what causes random and short-term bouts of canine diarrhea.
Puppies and young dogs may be vulnerable to certain infections and diseases which are known to cause diarrhea. These can include trichomoniasis and canine parvovirus. The best way to prevent such illnesses are to have your pet vaccinated against them, and to avoid contact with dogs who appear ill or who have had a known illness recently.
Illnesses like parvovirus generally start out with symptoms like lethargy and loss of appetite. This eventually progresses and later symptoms can include canine diarrhea, vomiting, and sometimes death. Be sure that you take note of any additional symptoms your dog has to ensure that you get proper medical treatment as soon as possible in the event he has a serious condition.
Another way you may be able to prevent canine diarrhea is to avoid switching dog foods, or to switch them slowly if you have to make the change. Some food types or brands may not sit well with your dog's stomach, and diarrhea can result. To successfully change foods, start by adding a little bit of the new kind with whatever type your dog is accustomed to. Slowly increase the amount of new food while decreasing the old one until your dog is eating only the newer food type. If diarrhea does occur, discontinue the new food or lower the amount.
When your dog does get diarrhea, it will usually clear up on its own if no other symptoms are present. In the meantime, make sure your pet drinks plenty of water. You can can also give your dog an electrolyte solution or drink if your vet approves this plan.