Actually that is your fault. You're supposed to maintain a 3 car length distance behind, and most likely you were all beeping and creeping through the light during rush hour.. you have to wait to make sure you can clear the intersection, not just go and it's HIS fault. It is absolutely your responsibility and you have to own up to it.
Unless he happens to legitimately stop with no one in front of him for no reason, and then you get ticketed, which is weird, then you're at at fault.
And yes, you can get out of the ticket if it's your first offense, but what is more likely to happen is you pay the fine and it goes off your record, which is really what counts in terms of your future driving record and insurance premiums.
Really though, think about if you're stopped a light, and everyone goes through a light until it's red and it piles up and there are 3 cars blocking the intersection, ALL because the people didn't want to wait out a red light, and how frustrating and rude it is.
Again, unless this guy stalled for no reason, why wouldn't it be your fault. You can say "Well, why didn't THEY get a ticket" but that's just dumb luck, he can ticket all of you for breaking a law and he chose you.. Doesn't mean you aren't at fault.
And if the car stalled in the lane, why were all of you in the intersection and why did he ticket you out of all people?
It really seems to me you're in the common situation described above, and you're just angry you got the ticket, but yeah, it's your fault. Sorry. Be more considerate of the other drivers in the future, because there are far too many inconsiderate drivers in the world.
If this is your first ticket, go to court, talk with the public defender and explain what happened, show remorse and OWN UP TO IT, attitude counts for a lot, and ask if you can get a break by having it removed from your record if you pass a probationary period. If the Judge has any leniency in his bones, and believes you are young and made a mistake you won't repeat, you can get that off your record, and that is important in how much you will pay for future car insurance premiums.