An April 2021 study found that,

“… a pro-inflammatory diet can contribute to testosterone deficiency, among other potentially debilitating health issues," 

"Our results suggest men who eat a pro-inflammatory diet [a refined diet** that scores high on the dietary inflammatory index (DII)], particularly those who are obese, are more likely to have testosterone deficiency," 

**A refined diet includes foods that contain refined carbohydrates and sugar as well as polyunsaturated fats.

The study also said,

"Since men with obesity likely already experience chronic inflammation, physicians should be aware of contributing factors, like diet, that could likely worsen this inflammation and contribute to the risk of other health conditions, such as diabetes and heart disease.”

A more anti-inflammatory diet "could be a feasible method to reduce the accumulated inflammatory burden, [potentially] leading to an increased testosterone level.”