I’d say ask your doctor, a reputable functional medicine MD, or a reputable, properly certified dietician. If you’re already past the point of self-guided plans like Matt Fitzgerald’s or similar (you’re far enough up the performance ladder you’re chasing marginal gains), be sure the person you work with is following their own advice and showing good results, whatever their age.
Googling suggests tests to recommend diet are trendy (based on sources like Shape, Health, and other popular media). The test strategies usually involve one or more of blood, DNA, and lifestyle analysis. For testing to work, you’d need regular testing (at least annual) so you can adjust as needed.
Blood tests that detect nutrient deficits seem reasonably valid, though personal variations may mean the lab’s “normal” isn’t valid for you. Each doctor may have his/her own interpretation of “normal.” For example, mine likes Vitamin D numbers at or slightly above the upper end of what the lab calls normal and is happy to cite the body chemistry and studies that lead to his preference. I’d rather discuss tests and test results with a medical professional face to face than a web site, regardless of what they claim about privacy and data security.
I seriously question all but the most well-vetted genetic tests (heart disease risk, etc.) because we don’t have a comprehensive enough view of the human genome to say, “You need 1250 mg of sodium a day, not 1400 mg.” Most of the well-vetted tests are high level and need tests for specific body chemistry to confirm specific, personal risk as opposed to a generalized risk based on genetic profile. For example, you may have a genetic propensity for heart disease, but have good cholesterol levels and balance, low coronary inflammation scores, good aerobic fitness, etc., that mean your personal risk is low. Also, given the reports of occasionally questionable results from some of the big DNA ancestry companies, companies recommending wine based on your DNA, etc., I don’t trust them with diet recommendations. I’d rather talk to a person I trust.
Lifestyle testing is potentially useful, but probably won’t tell much you couldn’t figure out yourself if you’re honest with yourself. (“But I have a 400 calorie deficit every day, so that nightly, large serving of ice cream is okay.” Probably not.) Sometimes figuring out the questions is challenging. I think that’s the main value of this type of testing–learning the questions you need to ask. Again, rather talk to a person.