To get ants out of your carpet, use ant bait or ant kill. The ant bait will be carried by the ants back to their nests and fed to the queen. When the queen eats it, she will, causing the collapse of the colony.
Vacuum until you can no longer see any. Then use a powdered carpet cleanser, leave it in for 15-20 minutes, then vacuum again. Keep them out by fumigating your home if necessary.
The best way to get ants out of your carpets is to keep the carpet clean.Sweep the floor under the carpet daily.Keep the carpet in the sun atleast once in a week.Change the carpet every week.Donot allow your children to spill on the carpet.If you have the problem persisting use the insecticides for best result.
Sprinkle powdered boric acid into the carpets. Boric acid makes microscopic scratches in their exoskeletons, and this causes the ants to become dehydrated and die. If you mix it with powdered sugar, they may take it back to their nests and kill more ants.