Oh dear, that dragon looks very ill
For starters, let’s go over your lighting. What type of UVB fixture do you use? Is it a coil or a tube lamp? No coils, please! They are very inadequate and provide little to no UV — that could contribute to this sudden illness.
Ideally, you should be using either a Reptisun 10.0 bulb or an Arcadia T5 bulb. Inferior brands such as Zilla or Zoomed aren’t recommended and could even cause the same problems that coil bulbs do, again, another possible cause of this illness.
As for basking bulbs, the wattage you should have varies by brand. Please don’t use a deep heat projector, they dry out your bearded dragon! Your basking spot should be within the 105-110 degree range, since a bearded dragon’s preferred core temperature is 97f.
How are you measuring the temperatures? Digital probes are the most accurate, please don’t use stick-ons or temperature guns. What is the humidity? Should be between 30-48%, can get higher at night.
With that out of the way, let’s talk about her diet… I’m sorry to say but what I see in that food bowl can be pretty harmful, spinach is a calcium binder and should never be fed. Pellets are also a big no-no, those should not be included in her diet whatsoever.
Is that all she gets in her salads? Remember to include variety, for example, I use three different staple greens with a variety of squashes and legumes. I’ll list some different staple green options below, along with some other greens/veggies you can include.
Staples:
Collard greens
Kale
Mustard greens
Dandelion
Cauliflower greens (not the head)
Beet greens
prickly pear (peeled)
Endive
Escarole
Alfalfa
Occasionally:
Bell pepper
Squash
Zucchini
Green beans
Snow peas
Carrot
Some flowers
Never:
Spinnach
Broccoli
Cauliflower heads
Avacado
Mushrooms
Iceburg lettuce
I hope that clears things up salad wise, please change that up asap. As for live feeders, she is an adult so she only needs 5-6 appropriately sized insects 2x a week. No larger than the space between her eyes.
Make sure you are using some of the following staple insects:
Roaches
Crickets
Silkworms
Pheonix worms
Locusts
Mealworms and superworms are great feeders as well but their hard exoskeletons might cause her some tummy troubles since she’s already so frail and weak. How long has she been like this? I’d assume a while considering how malnourished she is.
If it’s been a long time since she ate properly, try and avoid Waxworms or butterworms. Their high fat content might make her more sick, but if it hasn’t been too long you could try and give her some of those to get her weight up. Only a few at a time.
What is her supplementation schedule? Her feeders should have been dusted with calcium for every meal, D3 isn’t necessary if she has the proper UVB fixture. You could run and pick up some multivitamin since she isn’t eating salad I’d assume?
I’d also pick up some probiotics, mix a safe amount of each supplement with some distilled water and crushed insects and greens to make a slurry. You need to get food into her FAST. Get a non-sharp syringe and gently poke it in her mouth.
Go slow, make sure she swallows. She is very frail and weak. It might be hard for her. Do that several times a day in small amounts, every day of the week. She is severally underweight and dehydrated. You could try to drip some water on her nose to drink.
You say she has a hard time defecating? I’d guess constipation from severe dehydration, blockage from internal issues, or impaction. Is that plain sand you’re using? Plain sand should not be used as substrate unless it’s mixed with reptisoil, topsoil, or cocofiber.
Change it out asap, you could use either a mix of topsoil/reptisoil/cocofiber and sand, tile, cabinet liner, or zen mats. Please no reptile carpets, or reptibark. They are both hazardous.
I am so, so sorry

I do think it could be old age catching up to her, she might not have long. My heart goes out to you and your family, she was very loved. Keep us posted if she gets better, she’s a trooper for living to 13!