Cleaning algae from your rain barrel
Use and drain the barrel regularly. This is the easiest method. Regular use and/or draining of the barrel will snuff out any possible algae growth. So, use your barrel regularly. If you're going to be gone for an extended period, then drain the barrel!
A solution made from equal parts each of Castile soap and vinegar, or lemon juice, is effective at removing any residue from the inside of the barrel— and is safe to rinse out on grass!
You can also pour 3% undiluted hydrogen peroxide into a spray bottle and spray it on the surface to be cleaned, and let it sit on the surface a few minutes. You can then wash it off or allow it to break down into oxygen and water on its own.
Other options:
Use bleach. The EPA gives guidance on how to use bleach to disinfect drinking water.[1] The EPA states, "Add 1⁄8 teaspoon (or 8 drops) of regular, unscented, liquid household bleach for each gallon of water, stir it well and let it stand for 30 minutes before you use it. Store disinfected water in clean containers with covers." Bleach will keep the algae at bay.