The value of $gallery is not boolean. That is, it does not evaluate as true or false. You can see this by ticking a checkbox and simply echoing $gallery. You should see that its value is 1.
You should be able to achieve the desired result simply by removing == true from the if statement. That is, use something like:
if($gallery) :
echo 'Show in gallery';
else :
echo 'Don't show in gallery';
endif;
Broadly speaking, if($variable) will return a positive result if the value is not false and not zero. A more precise explanation can be found in the PHP manual.