Most carpets manufactured today are made of nylon fibers (polypropylene).
Polypropylene is a type of thermoplastic polymer resin (plastic), and therefore a non organic and not a food source for mold or bacteria to decompose. We use the same material in many other household products like, food containers, toys, microwaves, etc.
Mold on the carpet is usually on the dust accumulation on top of the carpet or in the backing of where glue is binding the fibers together and can be a organic source of food.
Typically if water damage to the carpet is attended rapidly and comes from a clean water source, and not sewage or other grey waters, the carpet can be salvageable and only the under pad needs to be removed and replaced.
We recommend consulting with a carpet cleaner to ensure it can be disinfected on both sides of carpet. You can also use benefect to remove mold in your carpet: http://www.benefect.com/US/mold.php