As bacteria and viruses are not easily washed off of fresh produce, limiting contamination is the best practice: By preventing the introduction of pathogens into the garden, risks of foodborne illness are minimized, increasing safety of the final product.
Here is a handbook for beginning and veteran garden organizers from the North Carolina State University outlining how to reduce food safety risks in school gardens and community gardens.