You can contact them at any time but before a couple months out they always tell me to contact them closer. To get the best information you want to be within a few weeks incase something changes. It may depend what you need though as it can take a couple weeks to get information. I will be honest with you, out of somewhere around 100 table service reservations I have notified them about over the years with a list of a dozen allergies I have had exactly two chefs respond to me. Both of them said they would be prepared, one volunteered a safe brownies. At both locations we showed up and they acted like we blind sided them because they had nothing ready. I told my son they were making brownies for him and that chef had no idea what we were talking about- so the only single location he would have had a baked good then didn't have it.
The point is that they try and special diets can be interesting to contact but I get much better and more useful information just asking online and being prepared. Disney won't answer most questions directly for fear that they will answer wrong or a product will change and then somebody relies on that info and gets angry or hurt. The best thing they give out are those allergy product lists, but they update the pdf once or twice a year and it's not a list of everything they stock. It is a list of exactly what was ordered on the last order. That means if they had a product in stock it's not listed so it doesn't include their stock or any of the "regular" items which is essentially the list of ingredients they have to work with. It won't tell you what type of hot dog, what fries, what sausage, bread, etc. it will only tell you that IF the regular doesn't work they will offer you X brand. So even in the best case scenario you are only getting half the information if you are lucky.