The usage of the verb "varies" (to vary) impacts how you write this sentence.
Consider how the sentence would look without the word "varies" : The number of bacteria depends on the weather. In this sentence, it appears that bacteria forms solely on weather conditions.
Now, with applying the verb "vary", depends becomes the adverb, and vary becomes the main verb: The number of bacteria varies depending on the weather. In this sentence, it appears that weather is one of many factors that can affect how bacteria forms.
I look upon depending on as a preposition (i.e. as in varies with the weather).
A number of participles are used like prepositions, e.g. regarding, using, according to, considering. The "continuous tense" is irrelevant. Example: He played the piano using only his left hand (using = with).
What the number of bacteria vary with could be many things, including the weather.