All I can say is hit your macros during the time you aren't fasting and you'll probsbly be just fine, especially if you can take BCAAs during your fast. I did intermittent fasting for about 3 years straight while cycling, off cycle, in pct and everything in between. Not only did I not have trouble retaining mass....i built quite a bit on it too. And that was fasting 16 hours a day
If at all possible train only when you can eat afterwards. Dont train and then have a long time before you can eat. That can and will negatively affect you