This question has been asked before:How common were allergies during the Middle ages? Were they a known disease or a mystery?
. . . where u/michellesabrina and u/agentdcf both indicated that we don't have much information about this.
To those answers I can add a few details, but not more certainty.
While we don't have evidence that food allergies were understood as a medical phenomenon until recently, we do know that Hippocrates was very attached to the idea that "food is medicine", and there's a great deal of discussion of which foods people ought to eat for what symptoms- none of this is done with an explicit understanding of allergy, but in some cases you might conjecture a linkage. Without a concept of allergy, there's quite a lot of evidence people thinking about "what not to eat" in the ancient world.
The medieval world has discussion of foods not to eat, often for religious reasons, but there's less of the "food is medicine" idea. Medieval physicians approaching digestion were big on bleeding, purges and emetics, more a feature of their understanding of Galen than Hippocrates. . . they'd purge people for any reason and no reason, and although one can't find any identifiable record of this being prescribed for a food allergy, it probably happened.
We do have mention of people in the Middle Ages with elimination diets - often for weight loss. There's a tale of William the Conqueror's alcohol only diet (but I can't get to a primary source for this, so I'm not clear whether it happened or is apocryphal). Alcohol was on people's minds a lot, we've got a medieval tale that drunkenness will lead you to conceive daughters. Similarly in the ancient world we're told that Constantius ate no fruit . . . the question of "why not" can only be a speculation.
You will see that some people answer this question with reference to "the hygiene hypothesis" -- the notion that we have more allergies today because we live in a world with much less chronic infection, and hence exaggerated responses to some antigens. This is an assertion that has some merits, but you will see things claimed as fact that should be phrased as hypothesis. One could equally hypothesize that people with severe allergies may simply not have survived long. We don't have much insight into hypersensitivity responses in antiquity or the middle ages; we can note that Hippocrates advocated apitherapy (bee stings) for certain conditions we know know as autoimmune processes, albeit without understanding any immunology. . . and without mentioning anaphylaxis, so far as I can find.
The most notable observable food sensitivity related behavioral change that we can observe is lactose intolerance-- not exactly an allergy, but a similar kind of dynamic. "If I eat X, I don't feel so good, so I don't eat it". Milk and cheese are likely more common foods among Northern Europeans in the middle ages, less so around the Mediterranean. This isn't a "food allergy" but a rather an intolerance-- and we do see patterns of dairy consumption mirroring frequency of lactose tolerance (though which way the causality goes is another question).
Sources:
ABEL, ERNEST L. “‘Who Goes Drunk to Bed Begets but a Girl’: The History of a Renaissance Medical Proverb.” Journal of the History of Medicine and Allied Sciences, vol. 54, no. 1, 1999, pp. 5–22.
Rohrbacher, David. “Why Didn't Constantius II Eat Fruit?” The Classical Quarterly, vol. 55, no. 1, 2005, pp. 323–326.
Megan Scudellari. "Cleaning up the hygiene hypothesis"Proceedings of the National Academy of Sciences Feb 2017, 114 (7) 1433-1436; DOI: 10.1073/pnas.1700688114