A good and easy and natural way of getting rid of dog smell out of carpet is to use sprinkle baking soda onto the carpet and let the baking soda sit on the carpet overnight.
Then in the morning use a carpet cleaner machine and add some vinegar to the carpet cleaning machine and run the carpet cleaning machine over the carpet.
The vinegar and baking soda will help to remove the dog smell and dog odor from carpet.
You can also spray some vinegar onto the carpet as well and then vacuum the carpet if you don't have a carpet cleaning machine.
Renting a carpet cleaning machine would also be a good idea and use carpet cleaning solution to help draw the dog smell and other odors out of your carpet.
Your carpet will also be cleaner and look better as well.
At least once per month I would recommend sprinkling baking soda onto the carpet to keep the smell down.
Or use some dog urine odor neutralizer which also helps with dog urine when they pee on the carpet and helps to keep other dog odors down as well.