Be careful not to scrape the clothing itself, as this can damage it. Scrape off as much surface mud as you can before washing the clothing.
The laundry detergent helps to break up the mud and makes it easier for it to come out in the wash.
Stain remover is a good option if the mud is really caked on and is very thick.
If the clothing is made of fabric in light colors like white, you may not want to soak them, as this can expose the fabric to the brown pigment in the mud. Pretreat the clothing with detergent or a stain remover instead.
Inspect the clothing after one washing cycle to confirm the mud is gone. You may need to wash the clothes more than once to get the mud out. Do as many cycles as needed until the clothes come out clean and free of mud.
You can also try using a toothbrush or a scrub brush to remove the mud as you hand wash the clothing.
Make sure all the mud and staining is gone before using the dryer, or the stain will be permanently set in the clothes.