In the creation of Star Trek Gene Roddenberry wrote the future society as a utopia. There is no need for money, there is no hunger and there is little to no violence inside of the Federation. I understand that there are weapons still - that doesn't seem contradictory to a Utopian society. Why is there a kill setting on phasers though? In a society that has advanced in all aspects, why would there be a need or desire to have a kill setting on a phaser? A setting that will immediately disintegrate anyone it hits. It seems not only counter to the society but completely unnecessary. Now I am aware that it is used many times in different episodes as the only solution to certain problems but despite that I wonder why it's even a necessity. Some other solution may have worked just as well, but using the kill setting was easier. Also there seems to be nothing keeping anyone at all from getting a phaser and setting it to kill. Considering all of the different species and races they encounter it seems to go against the Prime Directive to even use the kill setting on a phaser. So why does that setting exist?
They didn't exactly have a kill setting; what it takes to kill different beings varies greatly.
The phaser was more than just a weapon, it was a tool. Like most tools, it could be used to kill, but you often see them used to do quite a few other things, ranging from (obviously) stunning and killing, to heating up rocks for warmth, or even brewing coffee. (No.. really.. they made coffee with them in The Corbomite Maneuver, as I recall.)
When they talk about putting phasers on 'Kill', they aren't so much putting them on a setting labeled 'Kill', as putting them at or above the level that is identified as being lethal to humanoid life forms. This setting may, however, be used for many other things.
The phaser could be thought of as less a weapon than a tool, although we most often see it used as a weapon. See Phaser Settings on Memory Alpha for more details on the settings.
All of that being said.. They were often used as weapons, and meant to be such, with lethal capacity. Although humans may have had a utopian society, but they still had enemies, and there were dangers to explorers of undetermined levels; lethal force was something they tried to avoid using, but were not foolish enough not to have available.
First, to quote yourself:
there is little to no violence inside of the Federation.
But outside, there is. There are Klingons, Romulans (depending on the series/setting) and other enemies, who probably won't be impressed with anything making them take a nap for a while.
Also, the whole setting isn't as pretty or utopian as you said. In Kirk's time they still use some kind of money (not really sure how it's called in the English version, but in German they call it ducats (which is rather odd, as most people here associate these with classic pirates/caribbean sea)).
Regarding the Prime Directive: The non-intervention part (killing or just talking) aims at species not being capable of reaching other civilizations (i.e. no warp drive or similar technology), so they're not influenced by them and to avoid things like sudden power shifts. Otherwise they would violate it, just by taking a trip out into space, but at the same time it's been a different Federation in Kirk's days.
But in general, I think it's just logical to have a kill setting as well, because more sooner than later you'll encounter bad guys, who won't mind getting taken out over and over again. Also it's been profen in more than one episode that it's possible to manipulate phasers so they become stronger or overload and explode, so not having this setting wouldn't really impact anyone wanting to actually hurt or kill people. Instead it just limits valid uses in case of self-defense (if you assume they're not out to hurt anyone intentionally) where killing your opponent is the only effective and viable reason.
The "kill" setting is not guaranteed to kill everyone and everything, it is named that because it kills most humanoid aliens(and I am sure for the extra awe-factor from the audience when the Captain orders "Set phasers to kill").
Despite being a "utopia", the Federation still have many enemies; they need phasers to defend themselves. They may abhor unnecessary violence, but when exploring diverse areas of space or defending their homes, sometimes it becomes necessary to kill an aggressor.
There is a kill setting in case one wishes to kill somebody.
There are many cases where immediately killing an attacker is necessary and stunning him (which might not work depending on the drug level of the attacker) would risk the attacker finishing his attack.
Phasers have a kill setting for the same reason that Starships have Photon torpedoes.
A Phaser has many different power settings for different situations. It is necessary to have the option for a "kill" setting if an enemy is too powerful or the "stun" setting cannot disrupt their nervous system.
There are other settings such as "Cut" "Dispersal" and even "Vaporize." All of these settings are similar to the "stun" setting, but have more energy which can be lethal to most humanoids.
In the new star trek movie (sorry for the bad example) Spock and Kirk set their phasers to kill while onboard the Romulan ship because if they were to let the Romulans live they run the risk of letting the entire federation get destroyed.
Intimidation is a major aspect of it. To quote from Lois McMaster Bujold's Shards of Honor
"I have an aversion to stunners, in that sort of situation," he said slowly. "Nobody hesitates to rush one, and if there are enough of them they can always get it away from you in the end. I've seen men killed, relying on stunners, who could have walked right through with a disruptor or plasma arc. A disruptor has real authority."
"On the other hand, nobody hesitates to fire a stunner," said Cordelia suggestively. "And it gives you a margin for error."
"What, would you hesitate to fire a disruptor?"
"Yes. I might as well not have it at all."
Curiosity prodded her, mulling on his words. "How in the world did they kill him with a stunner, the man you saw?"
"They didn't kill him with the stunner. After they took it away from him they kicked him to death."
Put people in a situation where they know they'll survive as long as at least one of their members gets through and they'll be willing to charge the person with a weapon. Give them a situation where each individual is risking their life and few will be bold enough.
Roddenberry's utopians are peaceful, benevolent, but not pacifists. ST explores the concept that no matter how advanced your civilization, there are always those who must be stopped. At times they resort to violence and the only way to respond is with equal force. (Read at least equal or superior.) So, it appears that Roddenberry disagreed with the pacifist view.