Not quite sure what problem is but if battery was dead OR removed engine will not idle correctly for about 15 minutes after battery power is restored .. Start engine and keep it running until it will idle.
RepairPal Certified shops can diagnose and repair your 1998 Mazda 626. They provide transparent pricing with a minimum 12-month or 12,000-mile warranty on repairs and services.