I think for that you might want to research Protein sparing modified fasting, https://en.m.wikipedia.org/wiki/Protein-sparing_modified_fas...
Gist of it is you still cut significant calories only eating like 500-800 a day in mostly low fat protien rich foods. Targeting only enough protien to avoid muscle wasting.
While I'm no doctor or nutritionist, my understanding is that it's for that case, you want some of the benefits of fasting like going into ketosis while maintaining lean mass.
Unfortunately I'm on my phone only this week so I can't try and find any studies about it, but I came across it first in connection with type 2 Diabetes. So you might have some luck googling those topics for more info.