A candidate is not acting as a representative of the government. In fact, the Hatch Act generally makes it illegal to mix the two.
https://en.wikipedia.org/wiki/Hatch_Act