It's hard to find reliable numbers for the weight of a TEU, but I'm seeing references to a "maximum gross mass" of 21 and change metric tons, and an empty weight of 2.4 mt. Let's make the math easy and suppose each of the 15k TEUs on a single ship are filled to half capacity, netting a little under 140000 mt.
The "long way" is some 3500 extra miles, which, at .04kg/ton-mile, is 1.96 million kg, or 19.6 thousand (metric) tons of CO₂. Per ship. Per trip. And that's just the extra emissions for going the "long way".
For sake of comparison, the notional "average" car emits about 4 metric tons of CO₂ per year.
I have no idea what the maintenance costs of the canals are in terms of emissions, but they'd have to be amortized across every ship that traverses them. Per another poster, almost 17.5k ships sailed through the Suez Canal in 2015, so you're looking, with very back-of-the-envelope math at a little under 20000 metric tons versus 1/17500th of the annual maintenance emissions for a ~200km long canal. For a single ship's passage through the canal.
The construction costs of a canal, on the other hand, have to be amortized across every ship that has ever traversed it. The fractions get ludicrously small there (though they are, admittedly, of a rather larger number).
Without knowing the actual emissions numbers for construction or maintenance, I can't be sure, but I'm going to go ahead and predict a clear winner...
EDIT: Corrected some bad inputs to my math. Please, someone double-check my calculations. It is, after all, the end of the day on a Friday. My brain may be a smidge soft...