The AT-AT walker is not a Main Battle tank, It's a Armored Personnel TRANSPORT. At-At Stands for All Terrain Armored Transport. Not Attack Tank. Ever wondered why it was so poorly armed for something of it's size? Because it's not meant to be used as a tank, it's meant to transport guys and not let them die. So of course the scarab wins, The AT-AT was never Built to fight against Equally sized vehicles like the AT-TE/HE *all terrain tactical/heavy enforcer* and Juggernaut *the one in episode 3, the earlier model was also poorly armed for it's size* were, *I.E Against the Homing Spider Droids, the MTT which like the AT-AT was a transport, the AAT, The Confederate Tank Droid, and such* That is unless the Scarab was only built to kill infantry.
"The Scarab should be able to take down an AT-AT... AT-AT are really slow moving transport machines with moderate blaster powerExactly, If it were used as a main battle vehicle it would have more guns than Mr.T has ammunition for his machine gun.