I have weight trained and done OMAD/keto for 160+ days in a row as my longest stretch. I gained muscle and lost fat during that whole time. The trick is to eat below maintenance but go really protein heavy. I ate 170g of protein most days.
If you do longer fasts you’ll likely lose a little muscle mass but a few days at a time shouldn’t be an issue. Something like two 72 hour fasts a month and OMAD the rest of the time should be fine if you get enough protein and no issue at all if you still train (except when fasting for days).