Can you prevent an allergic reaction to food by taking antihistamines before eating?

No. The only effective treatment for a food allergy is avoidance of the food. Antihistamines should not be relied upon to prevent food allergy symptoms which can be severe and even life-threatening.