Do some light strength training during fasts, like body weight exercise or light to medium dumb bells or resistance bands, to maintain muscle during a fast. Train slightly harder just before you break a fast, then eat good quality food when you are refeeding. Go to town on resistance training during feeding periods. You won’t lose muscle.