Your child is having gastroenteritis
mostly of viral.
Try to maintain his hydration by giving sips of oral rehydrating solutions ,coconut water and lemon water with some salt.
It is looking not related to his dietary thing.
Consult your Doctor for the examination of his hydration status and for specific treatment.
Hope i have ansered your query.