If you see a doctor, they will first ask about your symptoms and what you had to eat or drink right before the symptoms started. If it's a regular problem, it can make sense to also keep a "food and symptom" diary for several days or weeks.
Like with other allergies, skin tests and blood tests can help to find out what is causing the symptoms. In the blood test, the doctor checks whether your body has produced certain antibodies (particularly IgE antibodies) to specific foods. In a skin prick test, solutions of potential food allergens are put on your forearm with enough space between them and your skin is gently pricked so the allergens can get into the skin. The skin is then observed to see whether it turns red or itchy and bumpy.
Doing an elimination diet can help in the diagnosis too. This involves avoiding the foods you think you might be allergic to for one to four weeks, and keeping track of any symptoms in a food diary.
To be more certain that you have a food allergy, though, a provocation test usually has to be done too. Here, the person who is thought to have a food allergy eats small amounts of the food in question under the supervision of a doctor. This is done to intentionally trigger the symptoms. Depending on how severe the allergy is thought to be, the test is done in a doctor's practice or in a hospital in case urgent medical treatment is needed.
In children and teenagers, allergy tests are repeated regularly in order to check whether the food allergy has gone away again. Just how regularly will depend on the food that triggers the allergy: People with milk allergies, for instance, are tested more often than people who are allergic to peanuts or other nuts. This is because milk allergies often go away after a few years. Babies and toddlers only have blood tests, not skin tests.