It is generally recommended that you install baseboard before carpet. This is because it is much easier to install baseboard when there is no carpet in the way. Additionally, if you were to install carpet first and then baseboard, you would likely have to trim the baseboard to fit around the carpet, which can be difficult and time-consuming.