Install drywall on the walls before installing floor covering.
Both drywall work and floor installation create a mess, but drywall’s mess far exceeds that of flooring. By putting in the drywall first, you separate drywall and its dust from the flooring later on.
Easier to Change Flooring Later
If you were to install flooring first, pushing it against or close to the wall studs, the drywall would then extend over the flooring. This effectively traps that edge of the flooring under the drywall, making it more difficult to remove the flooring.
When the drywall is being installed in the ceiling, it matters less because that issue of drywall trapping floor covering is eliminated. Still, you have the issue of mess to deal with, which can be significant when hanging drywall on a ceiling.
If you have the following conditions happening all at once, you may want to consider installing flooring first: 1.) you are hanging a significant amount of drywall; 2.) the flooring is unfinished wood. This point was brought up by a commenter at the Fine Homebuilding forum, stating that the humidity spike caused by drywall finishing and the painting can cause the flooring to “swell and buckle.”
Tier 1 – Trade Forum
Fine Homebuilding’s forum has a good discussion of whether drywall or flooring should go in first, along with that point about drywall finishing’s humidity having the potential to affect raw wood flooring.