We present a many-body theory of a driven and damped trapped gas of interacting bosons, and demonstrate that one of the trap levels can become coherently populated, thereby leading to a coherent atomic-beam generator, or ``laser for atoms.'' The specific system we consider consists of a sample of bosonic atoms interacting via the near-resonant dipole-dipole interaction. The transverse center-of-mass motion of the atoms is confined by a two-dimensional potential well created by an array of cooling laser beams, while their longitudinal motion is quantized by a Fabry-P\'erot for atoms. Under appropriate conditions, the dipole-dipole selection rules lead to the simplification that only two quantized levels of atomic motion need to be considered explicitly, the other levels being treated as reservoirs. One of the two levels is the ``pump level,'' while the other is the one where atomic coherence builds up (the ``lasing'' level). The master equation describing the dynamics of these levels can be solved numerically, and its solution exhibits a ``threshold behavior'' with a transition from super-Poissonian to Poissonian atom statistics in the ``lasing mode.'' \textcopyright{} 1996 The American Physical Society.