To get mud stains out of clothing you should let the mud dry out first and then scrap the excess mud off the clothing after the mud has dried.
Then apply some liquid dish soap such as dawn dish soap to the mud stain and let it sit overnight.
After that use a wet a toothbrush and a few drops of water to work the detergent into the stain.
Then wash the clothing as normal in the washing machine and the mud stain should be out of the clothing.
You can also apply some hydrogen peroxide or some stain remover such as resolve clothing which is a wonderful stain remover for clothing.
I use Resolve stain remover on really tough stains on clothing and it works great.