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:
$$C_0\leq f(K,L_0,aC_0)$$
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:
$$C_1\leq f(K,L_1,a(C_0+C_1))$$
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:
$$\max_{C_0,C_1}\beta^0L_0u\left(\frac{C_0}{L_0},aC_0\right)+\beta^1L_1u\left(\frac{C_1}{L_1},a(C_0+C_1)\right)$$
where $u$ is decreasing in the $CO_2$ terms. This could be subject to a simple production constraint:
$$C_i\leq f(K,L_i)$$
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.