A 504 plan is an educational plan for children who have a medical condition that impacts the ability to be successful in the classroom. An allergy to certain foods is usually not a reason to get a 504 plan. For allergies the nurse can keep an epipen at school for the child, and the classroom teacher and students are aware of food allergies in the room (especially peanut).
504 plans are for children with anxiety, depression, severe asthma, ADHD, and other such medical conditions that would keep them out of school or impact how they perform in the classroom. It provides accommodations that can be made for a child in school.
For example, I taught a student that was diagnosed with ADD and anxiety that was severe enough to cause migraines. The migraines kept him home from school, which created absent work, which caused stress, which caused more migraines, which caused him to miss more school, and on and on. I suggested a 504 plan which allowed small accommodations like extended time to complete work, a chance to redo assignments for higher grades, completed study guides sent home before tests, and such. A child with a 504 plan still completes all the same work/curriculum as every other child in the class. This is how it is different than special education. Special education modified work, which may actually change what the child completes to easier, more appropriate assignments.
I hope this helps. You can always talk to your child's school, but in my experience as a teacher there isn't a need for a 504 plan with allergies because the school is always willing to do what is necessary to protect your child.