Best is a very relative term. What is your definition of best?
Minor smudges are easily cleaned with most any off-the-shelf carpet cleaner in the car detailing section of your local Wally-World. "Economy" is the best key here. Meguire's products are at the high end of this example.
Replacing the carpet with new is always an option. "Complete" cleaning is the best key here. Only works good for a totally wasted piece of carpet - burns and grease.
A rented steam cleaner also works great, if you have other household applications to attend to at the same time. "Thorough" cleaning is the best key here. Works with some grease or oil, but not too well. Works good for ground in dirt.
I presume you're looking for something at the detail shelf of Wally World. I use the stuff in the arisol canister with the blue cap. Works great for small areas, and is inexpensive. can't remember the name. Won't work on tar or grease, just dirt smudges. You gotta have a real strong vacuum cleaner.
Good luck. Maybe you could tell us what type of dirt you're lookin' at?