While the first rule of care for a straw cowboy hat is to keep it dry, and the second rule is to keep it clean, spills and mistakes do sometimes happen. Usually a damp cloth and a bit of attention are all your hat will need to repair small mistakes. Anything harsher--or wetter--than that would cause the straw to disintegrate.
Brush your straw cowboy hat regularly with a whisk broom to help keep it clean. The more preemptive cleaning you do, the less you'll actually need to spot-clean your hat.
Sponge away any stains with a damp cloth. Never soak your hat or saturate it with water to clean it, as this will cause the hat to lose its shape and possibly even disintegrate. If you accidentally soak the hat during this process--or if it’s been soaked by rain--use a clean, dry cloth to sop up as much water as you can without rubbing, then turn out the sweatband of the hat and stand the hat up on the sweatband to dry so that air can circulate underneath it.
Mix a bit of liquid dish soap and lukewarm water in a small bowl, then sponge away any particularly stubborn stains on the hat with this mixture. Follow the same precautions against soaking the hat as described above.
Blot over the places where you applied detergent with a clean, damp cloth to help remove any remaining traces of detergent. Sop up any excess water with a dry cloth, then stand the hat up on its sweatband to dry.