There are a number of ways you go about doing it.
First of all, you don't engage in overt political activity.
Second, to the extent that politicians try to politicize the public service, you push back on that.
Third, you give your best advice. The advice isn't tone-deaf to politics because there is no point in giving advice that has zero chance of being implemented, but it is the best neutral advice you can give.