The baseboards should go in before the carpet!! I would leave 1/8 inch above the highest point (basement floors are never level). As you go around that gap may grow by as much as 1/2 inch or even 3/4 inch depending on the floor. The carpet guys will then hide this gap. If the gap needs to grow any larger then I would recommend scribing it, but that is a lot of work. So sometimes if you see the floor is dipping a lot for a certain area, then you can drop the whole board to a different level (for a section) at a place where the eye will be tricked into thinking the basboard is same level everywhere. If you wait for the carpet install, you will have a very hard time getting the base level because those carpet guys will simply come up tight to your drywall, (they need a backwall to avoid doing tuck and fold of edges thats what the baseboard is for). Get the base in first!