Should I paint bathroom before installation of a new vanity?
Paint first.


You don't have to worry about getting paint on the vanity.
Areas that would be hard with the vanity in place - in my bathroom, small wall sections on each end underneath the vanity since the countertop is wall-to-wall but the vanity is (deliberately) a little shorter - are very easy.
If you ever replace some or all of the vanity, countertop, etc. and the replacement is slightly smaller you won't end up with unfinished areas that then need to get painted.


But overall it is just simpler to paint large sections of walls than dealing with lots of edges.