Having a code of conduct makes people feel more comfortable when participating/contributing to your project. It also makes it easier to make decisions in case there is unfair/non-acceptable treatment in between community members.
If you don't know where to start, take a look at: