In principle this is easy: The best time to lose weight is the furthest away from competetion. The best time to gain weight is when volume is high. Which is often also the time furthest away from competition, so in practice this is complicated.
You should plan your weight gain and loss in a way that it minimizes hard training days where you are underfed, and minimizes the amount of the caloric deficit on such days. So if you have a comp in July, and you are already at the top of your weight class, the best course of action (given it makes sense to stay in that weightclass) would stay at that weight so that you will have no bad training days foodwise.
In general I would recommend starting in the next weight class, unless there are good reasons to do otherwise (winning, starting with all your friends in the same weightclass, logistics when the other weightclass starts another day, you cannot change your weightclass anymore).