My 2005 Ford Focus zx3 Hatchback battery light goes on and off. Could it be a sensor?

I went to Toyota because my battery light kept coming on and off plus my car would sometimes die at a red light. I went and they replaced my battery. On my way home the battery light came on and off again. I took it back and they said everything tested out fine. I just took it home but a few days ago my car shut off at a red light. I took it to Autozone thinking its my alternator but they said it was working fine but they said my tensioner belt needed replaced. I took it to Toyota again and they said they didn't know what was wrong because everything was checking out fine. They put the belt on today but the battery light came on AGAIN. I don't know what to do about it. Any suggestions?

Firstly to clarify something - the battery light will always come on when the engine stops whilst the ignition is still turned on so maybe you are just seeing this and in fact this is normal and not what is actually wrong or a symptom of what is wrong with the car.
The car may be just stopping the engine due to a fault with the Idle Air Control valve and then the light comes on as it stops or just before as the engine speed falls below normal idle

It really does sound like all your problem is just the idle. You probably never needed a new battree, sorry to be the bearer of bad news, but that's manic shops for ya. Adjust the idle higher and your problems are gone!