It depends on where you are at. For men body fat between 18% and 24% is considered an average body fat level. For optimal testosterone, body fat levels of 5% to 12% are usually what to aim for, to have your best natural testosterone levels. If you are already within this body fat % bracket then it can be harder to keep testosterone higher if you are planning on dieting down further. If you are above 12% then your testosterone levels may not be optimum, so by dropping off some body fat in a healthy way, and then maintaining it, it may improve things big picture.
The dieting process itself though can lower testosterone levels, in 3 ways mainly – by not eating enough fat calories, excessive stress, and any loss of lean muscle mass. The first thing to cover is keeping your lean muscle, or trying to increase it by weight training regularly, eating frequent protein meals, and eating enough fat too. The supplements that will help support your testosterone levels are Acetyl L Carnitine, Zinc, Magnesium, Vitamin D, Ashwagandha, and Maca. Citrulline Malate may also be helpful. If you want to cover the bases then Vitamin C can be additional help. Aim for good quality sleep, and rest too.
If you are eating low calories then regularly cycling in higher calorie days can help a lot (like in my RoughCut V2 Diet). The main thing though is to protect your muscle or grow more, that takes a lot of work. If looking for all in one Testosterone support, my Primal Man Test Booster is designed to help.
Train hard, and eat well.