The program RAPGAP generates events in ep collisions where the electron is scattered on a pomeron P coupled to the proton p. A gap in rapidity between the fast moving proton and the remaining hadronic system is observed. The program is applicable to photoproduction ( Q 2 ⋍ 0 ) as well as deep inelastic scattering ( Q2 > 0). Different types of hard interaction processes such as γ∗ q → q' and γrg → q q̄ for light and heavy quarks are included. Several options for the parametrisation of the pomeron and its parton density are available within the program. The hadronisation is performed using the LUND string fragmentation model. The Monte Carlo implementation is described and some phenomenological consequences are discussed.