when its dry outside this doesnt happen.
My car has 125000 miles.
My car has an automatic transmission.
When the Check Engine Light flashes, this can mean that the catalytic converter may be flooded with fuel and that a fire hazard exists. Because your car is sputtering, I believe this condition exists for you. When a car sputters or misfires, the motor is not completely burning the fuel in the cylinder and it is pumping the raw fuel into the catalytic converter. This can literally light it on fire.
With a condition that only exists when it rains, I would be looking for exposed wiring someplace. Most likely under the car. This would most likely be oxygen sensors, but it could be any harness that is somehow exposed to the rain. When this occurs, the water shorts out the reference signal to the computer and random symptoms ensue.
I recommend having your engine misfiring issue inspected by a professional mechanic, such as one from YourMechanic.