Someone once suggested asking "Do you have what you need?" and not "Are you ok?" Sounds more helpful and less condescending.
When it became apparent that this person did not know what he was doing, I would have offered to help: "Mind if I make a suggestion? Try doing it this way. Here, let me show you." Another approach is to simply assume some of the work. For example, you might check the tire for the cause of the flat while he was working on the tube.
After all that, I would also feel entitled to suggest to him that he stop at the LBS on the way home and buy the basics for flat repair.