Avoid tap water, and any food that may have been washed in it, at all times. No ice, no salads and no fruit you haven’t just peeled yourself.
Many travelers go veggie whilst in India. It’s not a bad idea. A dodgy bit of meat will do you a lot more harm than slightly undercooked vegetables. Plus, many Indians are vegetarian, so there’s a fabulous choice of vegetarian food. If you do eat meat, make sure it’s well cooked. If in doubt, eat at a place that’s packed with locals.
Toilets are notoriously bad in India, but they don’t have to be health hazards. Consider using the left-hand-and-water-jug method preferred by many locals (it is, after all, so much more hygienic than using dry paper), but don’t forget to carry soap with you so you can wash your hands properly afterwards.