There are so many hotels/hostels in bangkok, you can find very good value and clean quite easily. It helps to know where if you've been there before. There is also the ultra budget for those that travel on nothing. I was in this box once, I ended up in Bangkok and 40 dollars to my name. I found an interesting place called 'The Overstay' outside of the touristic area, it was three dollars a night. It was not amazing, the conditions, but I wasn't complaining.
RE: Dirty: Arrived in Bangkok and my first room was disgusting!