is it necessary to add sugar while making probiotic(fermenting) apple In many recipe I have seen adding sugar to water with starter and no salt. Then how does the undesirable bacteria are kept in check?

Thank you.
Undesirable microbes are typically kept in check via sanitization of the equipment and the environment; sanitizers are distinct from cleaners (soap, washing soda) in that they kill microorganisms. You can either purchase sanitizers (e.g. Campden tablets, Star San etc), or roll your own antiseptic solution:


  "dilute 2 teaspoons of potassium or sodium metabisulfite and 2 teaspoons of malic, citric, or tartaric acid in 1 quart of water" — Claude Jolicoeur. "The New Cider Maker's Handbook"


(Disclaimer: I don't use any sanitizers in my mead production and only clean the glass jars and other equipment. This may result in a wilder range of flavors, though.)