Losing muscle while dieting down is not likely to happen unless you have a stupid-low caloric intake, insufficient protein, or train excessively.
If your protein intake is high, your training is hard but smart, you should not be losing muscle – not until you get down to something like 8% body fat.
You might FEEL like you’re losing muscle because you feel flat and occupy less space, but you likely aren’t.
Maintaining strength is also a good way to make sure that you’re not losing muscle. But even some strength loss isn’t necessarily and indication that you’re losing muscle.