2.5 gallons is the smallest I would keep a betta in which is right around your tank size.
No matter what size the tank clean water is paramount for a healthy fish. In a small tank like that, water changes every other day would probably be necessary. With a larger tank you give yourself a little more leeway.
With no live plants and 8 hours of light those algae spores are having a field day in water with high nitrogen and ammonia levels