Crablab. I have had a similar incident in a C177 RG. It had been parked on a slope left wing low. It had not flown for a couple of weeks and there had been some heavy rain. I took off and the engine soon started running very roughly. I did a tight circuit and landed. After parking I found substantial amounts of water in the left hand wing fuel drain. When I did my preflight it was definitely all fuel in the sample and no water at all.
Closer inspection revealed the rubber seal on the left hand fuel cap had perished and was letting in water. Because of the slope the rain water would have gone into the tank and flowed down to the wing tip. Once the plane taxied out and had taken off the water made its way from the wing tip down to the centre where it affected the engine running.
I suspect you may have had water in the wingtip and your engine nearly stopping was the result of water not fuel imbalance. With the fuel tank selector on both and no water in the tank the engine will run regardless of any imbalance or even an empty tank.