If you want to determine how much carbon dioxide should be omitted by solving an optimization problem, then a constraint on the quantity of $CO_2$ isn't quite what you need. The normal constraint on an optimization model for a whole economy is the production function, so one way to include $CO_2$ would be to make it a variable within the production function. To illustrate this I make the simplifying assumptions that consumption in each period equals output, capital $K$ is constant, labour equals population, and that $CO_2$ emissions take place at the start of each period. Hence I write the first period constraint as:
where $a$ is $CO_2$ emissions per unit of output/consumption, and $f$ is increasing in $K$ and $L$ and decreasing in $aC_0$, the last point reflecting an assumed adverse effect of $CO_2$ on agricultural output. To allow for the accumulation of $CO_2$ in the atmosphere, I write the second period constraint as:
On solving the optimization problem with these constraints and obtaining values of $C_0$ and $C_1$, the $CO_2$ emissions in each period can then be calculated as $aC_0$ and $aC_1$.
An alternative approach, focusing on the direct effects of warming due to $CO_2$ emissions on human health and welfare, would be to reflect these in the utility function. So the problem might be formulated as:
where $u$ is decreasing in the $CO_2$ terms. This could be subject to a simple production constraint:
These alternatives could be combined, including $CO_2$ in both the objective function and the constraint, although the more complicated the problem becomes the more likely that its solution will be intractable.