Building muscle usually needs more food than you burn. A GLP-1 does the opposite: it turns your appetite down, sometimes to nearly nothing. So the textbook answer is that you can't build muscle in a big calorie deficit.
The textbook is a bit too tidy. In one study, young men eating well under their energy needs for four weeks, with high protein and hard resistance training six days a week, gained about 1.2 kg of lean mass while losing fat (Longland and colleagues, American Journal of Clinical Nutrition, 2016). The catch: they were young, supervised, trained almost daily and weren't on a GLP-1. Read it as "the body can do this", not as a forecast for you.
How much muscle people lose on these medications, and why the numbers disagree, is covered in are you losing muscle on a GLP-1?