Is it possible to avoid traveler's diarrhea by not eating street food?

Travelers diarrhea. Yes, avoid street food, drink bottled water and avoid fruits and vegetables.
Travel safely. Your risk will certainly be reduced. Check the health departments recommendations concerning the specific destination but generally drink and brush your teeth with bottled water, avoid street vendors and fresh fruit and salads cleaned with the local water supply. Ensure all your meets are correctly cooked. Check with your doctor about possible prophylactic antibiotics as well as vaccination status.
YES! Travellers' diarrhea is usually caused by bacteria ingested in local food or water. The easiest way to avoid this problem is to eat food from reputable sources and to avoid the following: un-peeled fruit, tap water unless boiled (this includes ice), rare meat, poorly cooked foods. The simplest preventive approach is to use pepto-bismol tablets, 2 tablets, 4 times per day (may turn stool black).