Good housekeeping is the best way to keep carpet beetles away or to eliminate a small infestation. Keeping synthetic carpets clean of animal hairs or dust is a good start. Dust is largely dead human skin, which carpet beetles can consume. Keep all foods sealed whenever possible.
If the infestation gets severe, you may find that you need to take more extreme measures. There are commercially-available baiting traps that often work very well. The alternative is to work with a local pest control expert who can safely and effectively eliminate your carpet beetle problem.