Which water purifier to use for a overhead tank?

My house is having two water connection one is MCD and other one is private. Many times the MCD supply water we get is dirty and makes whole tank dirty. Initially we thought there might be some leakage so we put our whole pipe overground and checked it, it was clean and good. So everytime we get dirty water we have to empty the whole tank to clean it. It's wastage of water and we face problems also. I wanted to know if there is any kind of filter which we can install in my tank at the point where water gets it (inlet pipe) so that even if dirty water comes in it get purified before entering into the tank. Or is there any other way to avoid that problem.

×