If he is getting thin and lethargic, could be many things. parasites, disease, stress, dehydration etc. Without more info on his husbandry (ie cage temps, substrates, feeding, basking temp, size of cage, cagemates (if any), when he pooped last, how long has this being going on etc), there isn't any way for us to guess at to what the problem is.
What I recommend, and most people here will as well, is take the dragon to a qualified reptile vet, especially one experienced with bearded dragons. Bring in a fresh stool(poop) sample (refrigerate, don't freeze till you take it to the vet). Only a qualified vet can properly diagnos a problem and recommend treatment. Most posters here, can only give suggestions or guesses, which may help or not.
-----
PHLdyPayne