Food allergies are usually the result of the immune system mistakenly attacking a component in the food we consume and eliciting an unwanted immune reaction. Certain changes in the genes that regulate different immune functions can put you at a higher risk for food allergies.
For example, the HLA gene system is an important part of immune functioning. Two genes - HLA-DR and HLA-DQ have been implicated in several food allergies, including gluten intolerance. Other genes that regulate immune functioning and play a role in food allergies include FLG, STAT6, IL10, and Il13. You can learn more about them here:
https://onlinelibrary.wiley.com/doi/full/10.1111/all.13767
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4340086/
However, human traits are a result of the complex interplay of genes, environment, and lifestyle. Food allergies do have a genetic component; however, it is important to remember that allergies within a family may also be because of shared environmental conditions.