Linguistically, dialect refers to any variant of a language, including the standard or most-spoken form of that language; colloquially, dialect refers only to sub-standard variants of a language that are more distinct than accents.
In writing, dialect, in the colloquial sense, is best omitted unless the writer has a great ear for it. Most who attempt dialect fail to do so well and instead thrust upon their readers inconsistent exaggerations. Dialect may slow down and make critics of otherwise passive readers, so use it carefully. If you must, stick to a dialect you know well, or study, listen, and read. Fine examples of dialect, both real and imagined, include A Clockwork Orange, Mason & Dixon, Riddley Walker, and Trainspotting.