Go to Walmark or Cantire buy a can of carpet stain remover. They usually come in as a spary can with a bush on top of the can. Most home paints are water based, so it can be easily remove with stain remover. I found using a bush is very effective to remover stains on the carpet. Also, use a paper towel to soak up all the dirty liquid once it has come off.
If it is oil-based, then you may need to try some alcohol based solvents, but I am not sure about the result.