Muscle loss is more of a calorie restriction thing (dieting). Counterintuitively enough fasting is not a form of caloric restriction, as far as your body being fueled is concerned; your body just switches to ketosis, drawing energy from fat.
After 4 days your Human Growth hormone levels shoots up around 400% which protects muscle mass, while your resting metabolic rate goes up by 15%.
You won’t lose muscle on 5-7 day fast. Every “study” I’ve ever seen that mentions “losing muscle” on a fast really measures only “lean mass” and “fat mass”. Fat mass is fat. Lean mass is everything else, which includes water weight. Total nonsense. Go ahead and fast. Your muscles will be fine.