Boat carpet is cleaned the same as your home carpets, if you have 16oz or thicker carpets , just rent a carpet cleaner, that has a cleaning nozzle similar to a portable vacuum cleaner .
Spot clean the really dirty areas first, with resolve or some other carpet spot cleaner, then use the regular carpet cleaner.
If you have non marine carpet, pressed felt stuff with no rubber backing ( super cheap porch carpet ), clean them at your own risk .. as they may fall apart.