My personal experience and personal belief is that people make too much of the "Montezuma's Revenge" part of travel.
If you follow a few basic rules your chances of having G.I. problems will be no greater than eating the food in a major U.S. city. (Yes: different water in different parts of the U.S. can give you problems. It's what you're used to.)
Don't drink tap water. Drink bottled water, soda or beer. If you have a mixed or blended drink only do so at a major bar. Straight shots of tequila are a great way to kill the germs.
Eat at restaurants but make sure your food is cooked and not raw. This includes salads and vegetables.
I have a major G.I. problem where I am very susceptible to "problems" but I eat local food in almost every location from Mexico, China, Egypt and other parts of the world and the only time I've had a major problem, while traveling, was a seafood dinner in Fort Lauderdale.
While it is against the rules to take food off the ship, you can. They won't search you on the way out but make sure you don't wait too long before you eat it. The hot temperatures and a hot backpack will make some foods, like sandwiches with toppings far more dangerous than drinking from a Mexican garden hose.