I feel best when I make sure to regularly consume organ meats like liver and heart, in combination with avoiding refined/ultra-processed vegetable/seed oils and grains.
The foundation of my 'optimal' diet is:
Red meat
Organ meats (offal)
Ruminant animal fat
Bone broth
Raw milk kefir
Kimchi
That said, everyone is different, and some people thrive on vegan diets (for example).
The above works very well for me personally though. I haven't taken very regular blood tests to correlate my nutritional intake with testosterone levels and other health markers; however, my energy levels, libido (and morning wood etc.), strength etc, do appear best for me personally, when I eat a diet which is ruminant animal based.
For reference I'm nearly 44, and not on TRT or other steroids/exogenous hormones.