A significant percentage of athletes regularly experience stomach discomfort, gas, bloating, and diarrhea when practicing or competing.
The physical and mental stress of exercise and especially competition may make problems more obvious than they are when someone is not being physically active.
After ruling out food-borne illness (which would tend not to persist for extended periods) this piece offers a few other common causes, what symptoms tend to go with each, how to explore each as a potential cause, and what to do to minimize recurrences.
Lactose intolerance can cause gastrointestinal issues, but is rarely limited to exercise occasions or accompanied by fatigue or muscle issues; cutting out all dairy is the test/management plan.
Bile insufficiency can cause gastrointestinal issues without fatigue or muscle issues (one symptom is stools float); limiting dietary fat, especially before exercise is the test/management plan.
Consuming sugar alcohols or fat substitutes can cause gastrointestinal issues and may cause general fatigue; cutting out reduced fat/calorie foods, candies, and beverage is the test/management plan.
Gluten sensitivity or full blown Celiac disease may cause gastrointestinal issues and/or general fatigue and/or muscle issues; limiting gluten intake is the test/management plan.
If none of those pan out there are many other food sensitivities that can cause gastrointestinal issues with or without general fatigue and/or muscle issues; keeping a food and symptom diary may be helpful or one can consult a doctor or other professional who specializes in such problems.