In this paper, we study weakly unital dg categories as they were defined by Kontsevich and Soibelman [KS, Sect.4]. We construct a cofibrantly generated Quillen model structure on the category $mathrm{Cat}_{mathrm{dgwu}}(Bbbk)$ of small weakly unital dg categories over a field $Bbbk$. Our model structure can be thought of as an extension of the model structure on the category $mathrm{Cat}_{mathrm{dg}}(Bbbk)$ of (strictly unital) small dg categories over $Bbbk$, due to Tabuada [Tab]. More precisely, we show that the imbedding of $mathrm{Cat}_{mathrm{dg}}(Bbbk)$ to $mathrm{Cat}_{mathrm{dgwu}}(Bbbk)$ is a right adjoint of a Quillen pair of functors. We prove that this Quillen pair is, in turn, a Quillen equivalence. In course of the proof, we study a non-symmetric dg operad $mathcal{O}$, governing the weakly unital dg categories, which is encoded in the Kontsevich-Soibelman definition. We prove that this dg operad is quasi-isomorphic to the operad $mathrm{Assoc}_+$ of unital associative algebras.