Your doctor will diagnose a food allergy mainly by history, combined with either skin or blood testing for more accuracy. Skin testing can be helpful, but there are many false-positives, which means the test says there is an allergy, but there is not. Negative results on a skin test, however, are very accurate that there is no food allergy, so that can be very reassuring. Blood tests are also poorly predictive, being accurate only roughly half of the time. However, high levels of blood tested antibodies are very suggestive of an allergy to that food.
If you think you may have a true food allergy, discuss it with your doctor and consider additional testing before permanently restricting your diet.