Is there any thing can i used to detect an bacteria or viruses for iot project?

Delta_G:
Only a subset. Definitely not all of them.

True, however polluted water is populated by fluorescing bacteria. They make fiber optic probes to test water for bacteria content that way. Here's an article.