The invention is directed to a method and composition for treating carpet yarn and carpet to thereby enhance its repellency, and preferably to enhance its stain resistance as well. In one aspect of the invention, the method includes the steps of providing a carpet yarn comprising polymeric fibers. An anionic or nonionic fluorochemical compound is provided in an aqueous medium, the aqueous medium having a pH below about 3.5. The carpet yarn is immersed in the aqueous medium. The carpet yarn and aqueous medium are heated after which excess water is removed from the carpet yarn. The aqueous medium preferably also includes an anionic binding compound that acts to impart stain resistance to the yarn.