Food sensitivities are one of the most common and insidious causes of mental dullness. The gold standard in food sensitivity testing is the elimination diet, whereby you eat just a few foods that are very unlikely to be problematic (such as salmon, lamb, rice, sweet potatoes, winter squash, and carrots) for a couple weeks to clear out any offending foods. At this point, if food sensitivities are implicated, you should feel much better. Then you systematically reintroduce suspected foods one by one to get a clear sense of how your body responds to them. If you are interested in trying this, please work with a healthcare provider,my self included, or at least read up on it, before you do it.
If the elimination diet sounds unbearably difficult, you can try one of the easier alternatives, none of which is quite as accurate. You can do lab testing (via blood sample), which I think is about 80 to 90 percent accurate at best. You can try the Coca Pulse Test, a method of testing for food sensitivities by looking for an increase in your pulse rate as an indicator that you've just eaten a food you're sensitive to. You can read and download the book in its entiretyHERE. Or you can just try cutting out all the most common offenders for a few weeks. Wheat products, corn products, eggs, soy products, and dairy products are most likely culprits. If you want extra credit, also cut out nuts, tomatoes, potatoes, peppers, eggplant, citrus fruits, rye, barley, oats, coffee, chocolate, shellfish, yeast, alcoholic beverages, and anything artificial - colors, flavors, preservatives. Then see how you feel.