How to find root cause of effect with multiple distractors

I am writing an app to determine most likely cause of stomache-aches of users. Reducing the problem to its simplest form, for each user I have a multiple lists of ingredients that leads to his/her stomache-ache. For example, the first dish to cause a stomache-ache might have milk, eggs, peanuts. The second dish to cause a stomache-ache might have milk, eggs, lobster, and so on. How can I aggregate these lists of dish ingredients to determine the ingredient(s) most likely to be causing the stomach-ache? Alternatively, is there a way to generate a score/probability of each ingredient causing the stomach-ache? It seems like a simple Bayesian problem, or perhaps a machine learning/clustering problem, but I haven’t quite been able to root down the specifics.