Sure as long as it's not pine or another toxic wood. I'd imagine yours is a juniper though.
Make sure the soil has nothing bad in it either as your beardie will likely try to eat some or at the least make a mess of it.
I personally would keep the bonsai outside the tank, but if you've made sure it's safe just be prepared for it to not last too long haha.
-Brandon