It could be due to mineral deficiency in your pets diet. Provide him balanced nutrition(commercial food)..If he is on home food...you can give him suppliments..Make sure you deworm your pet regularly...Distract your pet when it starts eating dirt with a verbal comand or by offering a toy to chew ..Leash your dog when you go utside, lead them away from aread with exposed soil...