We consider a Wireless Sensor Network where each sensor device is able to harvest energy from the environment, and randomly accesses the channel to transmit packets of random importance to a fusion center. If a collision occurs, the transmission fails and all packets involved are discarded. We design distributed transmission schemes where each sensor node, based on its own energy level and the importance of its own data packet, decides whether to transmit the packet or remain idle, so as to maximize the network utility, defined as the average long-term aggregate network importance of the data packets successfully reported to the fusion center. Due to the generally non-convex structure of the optimization problem, we resort to approximate solutions. In particular, we use a mathematical artifice based on a game theoretic formulation of the multiaccess problem, where each sensor node is a player that attempts to selfishly maximize the network utility. We characterize the Symmetric Nash Equilibrium (SNE) of this game, where all the sensor nodes employ the same policy. We prove the existence and uniqueness of the SNE, and we show that it is a local maximum of the original optimization problem. Moreover, we derive an algorithm to compute it.