It depends on your goal.
Some people are being more pudgy in their quest for size and strength, others (like me) hate it. If you are not comfortable with carrying too much fat it can actually decrease your motivation which will hurt your gains.
It also depends on your capacity to diet and lose fat. If you have gotten lean several times in the past then you now that even if you gain some fat you will be able to diet it off. If you have tried many times to diet down to get lean and failed, then allowing yourself to pile on fat in hope of building more muscle is likely a mistake because you have never been able to diet down so you likely will not lose the fat you added.
Your level of muscularity might also have its importance. If you have a lot of muscle already and you only want to fine tune the package then you don’t need much of a surplus and there is no need to gain fat in the process. If you are a beenpole you might have to gain some fat to be able to build a lot of size.
But generally speaking, the leaner you are the better your body responds. The workouts are batter, you are more easily motivated because you like what you look like, your body handles nutrients better because when you are leaner your insulin sensitivity will be higher/better.
From your questions and the way you formulated them it’s pretty obvious that you put a high value on leanness, and you current level displeases you. You likely have this ideal physique in your mind and you know you need to get a lot leaner and build some muscle to get it. In that case I suggest getting lean first.