We present deep two-colour photometry of two rich clusters at z = 0.18, A665 and A1689. We use these data to construct number counts as a function of magnitude in the two fields. By combining these counts with similar observations from a large area field survey we subtract the field contamination statistically to produce luminosity functions for the two clusters. Great care has been taken to achieve agreement between the photometry of these two samples. The cluster data are complete to a limiting magnitude of I = 22.5 or an absolute magnitude in the cluster of I = −18.0 (M⋆ + 5). The luminosity functions of both clusters are well described by a Gaussian function for the bright galaxies, combined with a Schechter function at the faint end, similar to that required to fit the luminosity function in local clusters. The slope at the faint end of the Schechter function in both clusters is extremely steep in V , α ∼ −2. A shallower slope is seen to the limit of the I data, indicating that the cluster population is rapidly blueing as we reach fainter. The excellent agreement between the form of the luminosity function in our two distant clusters, as well as agreement with the luminosity function given by Driver et al. (1994) for a single z = 0.21 cluster, indicates that this faint blue population is a general constituent of distant clusters. We compare our results with those from studies of local clusters. Depending upon the degree of fading (or disruption) of these faint blue galaxies, we tentatively identify their remnants with the low surface brightness dwarf galaxies which are the dominant population in local clusters. We discuss the possible role of this population as the source of most of the X-ray gas in rich clusters.