An elected head of state has, by definition, been voted in by those who think that they are a better choice than other candidates standing for election at the same time. So how do you prevent the candidates from trying to convince the voters that they are the best choice - ie, from campaigning for votes?
Inevitably the way to gain votes is by persuading voters that you are on the side of their section of the population and will make sure that is the section that will gain most advantage from the laws that will be passed under your presidency.
The voters are not non-partisan, they know what they want, and they can recognise who is likely to achieve most of that for them. They will vote for a candidate who seems to them to have all the virtues of left or right, or green or multicultural, or leans toward their own preference.
A totally non-partisan president is as rare as a unicorn.