If the dog you are planning to get is not housebroken, I would wait until that is accomplished. After that is done, I would go ahead and install the carpet and realize there will be accidents from time to time. Invest in some carpet cleaner to have on hand?