Make a solution of 1 teaspoon dish soap, 1 tablespoon white ammonia, and 2 cups of warm water. Gently sponge this cleaning solution onto the stain, and blot with a clean dry towel absorbing the liquid. The stain should begin to come up onto the towel.
For especially stubborn stains, you can make another cleaning solution with 1 tablespoon dish soap, 1 tablespoon white vinegar, and 2 cups of warm water. Repeat the sponging and blotting process as above, and the stain should come up from your carpet. Keep in mind however, some food dye stains are permanent.