No, they definitely cannot eat sugar cookies because it would give them a terrible stomach ache.
A bearded dragon in general has a digestive system that is made to handle insects and mostly greens. Even many fruits are not good for them because it has too much sugar.
Excess sugar in their diet can cause an unbalance in their gut flora.
If your bearded dragon was to have a tiny nibble they should be fine but nothing more than that and definitely shouldn’t be feed these cookies on purpose.
Bearded dragons cannot process grains and sugar and therefore it will make them sick.
A better option is wax worms and edible flowers.