I get this question a lot. The coins this person has have dirt, residue, old tape, tarnish, grease. You name it, it can end up on the surface of the coin. If you think about it, wherever a person goes, so doe his or her money. I am never ceased to be amazed at the condition of the coins that come into my office. Not only dirt, but damage as well. I see coins altered in many different ways. We see coins with holes(probably used as a necklace) and even see coins uses as target practice with bullet holes.
Getting back to the dirt. The long and short is that dirt does not necessarily make that coin any less valuable, however cleaning a coin more often than not will absolutely ruin the condition of the coin. Even the most experienced numismatist can damage a coin when attempted to remove the dirt. Dirt can, however be a problem, if the dirt prohibits the surface of the coin from being seen. This can be tricky. I had a gentlemen from Denver bring in some Silver Dollars to sell. They were common date and common mint with a high level of circulation, they were wore down pretty good. He obviously took some silver polish to them prior to coming in. Those coins were incredibly shiny. There wasn't a spec of dirt to be seen. I could just about see my reflection on these old coins. Because these coins were so heavily circulated and common, he really didn't hurt the value too much, however let's say he had a rare Carson City date. Some Carson City dollars, even in highly circulated condition are worth thousands. Let say he had one of those type coins and he polished it prior to coming in. He would have made a very expensive mistake. A coin he could have gotten over a $1000 for, could be worth less than $100 because of the irreversible damage that polishing does. You can't undue the damage. Once a polished coin, always a polished coin.
It's somewhat similar to the patina on an antique. The last thing you want to do with a hope chest from the 15th century is get out the sand paper and dewalt sander.
It's best to leave the coin in the condition you found it. Get that coin in front of an experienced, honest coin person for a look see. In fact, put in front of a few people if you like. Selling your coins can be complicated enough. You want to give yourself the best chance of getting the best price for it, but again, dirt is usually not the determining factor in a valuation of the coins. Generally speaking coins and old money is dirty. Handle a handful of wheat pennies for 10-15 minutes and look at your hands!