For the most part algae in your tank is harmless but annoying nonetheless. Algae grows in every healthy aquarium, no matter how well, or how often the tank is cleaned. There is absolutely no safe way to completely prevent or stop the growth of algae. Once it starts to grow in an aquarium, it does so very rapidly.
Although it’s rather unattractive, algae is not "dirt", but a primitive form of plant-like life. Like any other plant, algae needs light, water and nutrients to grow. Since an aquarium provides the water, we’re left with two factors that you can control to prevent the rapid accumulation of algae. These are: the amount of light the aquarium receives; and the levels of nutrients dissolved in the water.
Limiting the light that the aquarium receives is the most important factor in controlling algae growth. On top of that you will need to follow strict tap water pre-treatment, filtration and sterilization practices in order to cut the supply of mineral nutrients such as nitrogen, phosphorus and potassium on which the algae feeds on.