How many times do you have to wash vegetables before cooking?

Once BUT. depends a lot on what type of veg. Dirty root veggies need prepration in addition to washing.
As many as it takes. The key to properly watching vegetables is to remove all dirt, pesticides, foreign matters prior to consumption. There is no hard number on how many times the produce need to be cleaned.
Once. Most bacteria will be washed off good rinse and cooking will kill the rest.