Begin by thoroughly vacuuming the area to remove excess dust and dirt.
Next, mix a solution of 1 cup vinegar and 2 cups warm water. Transfer the mixture to a spray bottle, and mist the affected area with the solution. Be sure not to over wet the carpet, as moisture getting down into the backing can cause more mildew to form.
Lastly, sprinkle a generous amount of baking soda on to the affected area. You will notice some bubbling or foaming ? this is a normal reaction of vinegar and baking soda. Allow the baking soda to completely dry, and vacuum it away. Repeat as necessary until you can no longer smell the mildew.