I take great pains to avoid this issue. I think that planning ahead and anticipating the potential problem is the key.
I generally try to do all my construction work in so far as cleaning up parts and making mods before I do any painting, and then wash all of the subassemblies and loose parts (that will be painted separately) at once. This is my normal procedure.
If I have to paint in stages (like interior areas), I try to mask those off after painting and before closing them up in a way that allows me to remove those masks later during final assembly. This at least gives me a fighting chance at keeping construction “schmutz” (a technical scale modeling term) out of those already finished areas. However, all of those model parts involved will have been washed beforehand to include the major subassembly involved.
As for the rest of the external areas that are still under construction, I will continue to build in subassemblies, only handling the major hull subassembly when absolutely necessary and only attaching those parts that are also necessary to progress. It’s already been washed, so as long as I keep the new parts clean and the major subassembly away from the building bench (either by distance or storing in a closed box unless needed), I minimize the potential problem of getting it dirty before continuing to paint it.
I’ll wash all of the other parts and subassemblies that are built in this stage before I paint them and do final assembly and final painting.
I do keep a couple of large soft bristle brushes set aside specifically for dusting parts and subassemblies during construction. I am very particular to keep any sort of potential oily or greasy contamination off of these brushes to avoid transferring that to the model parts.
Finally, I also use my air brush as a compressed air blower before I paint. I’ll simply blow the model down as well as possible using compressed air before spraying any paint. I also tend to use a cellulose solvent-based paint for the initial paint coats over subassemblies that I can’t wash again. My thinking is that the cellulose solvent-based paints will “bite” through any minor surface oils or release agents to serve as a good foundation for subsequent paints. Kind of like a primer, but not done as a separate and additional coat of paint.
So, if I’m careful, I minimize any potential problems by: Keeping the major subassembly away from (or protected from by placing in a box), unless needed, the work bench; Only attaching the minimum necessary parts when I do handle it; Dusting it off by brush and compressed air before I do paint it; Using cellulose solvent-based paint for the initial subsequent color coats when I paint it; Washing all of the other external subassemblies and separate parts before I paint them and do final assembly and overall painting.
Finally, I’ll mention that for me, I’ve tried to build while wearing nitril or rubber gloves to avoid fingerprint type contamination on subassemblies that I can’t later wash and have found that I just don’t have the sensitivity and other fine dexterity that need or want. So, although some modelers are good with wearing gloves to mitigate these types of problems, that just doesn’t work for me. I do occasionally wear nitril gloves when painting, but that’s mostly to protect me from the paint (overspray usually) and not to protect the model.