Using data from the HEGRA air shower array, taken in the period from April 1998 to March 2000, upper limits on the ratio Iγ/ICR of the diffuse photon flux Iγ to the hadronic cosmic ray flux ICR are determined for the energy region 20-100 TeV. The analysis uses a gamma-hadron discrimination which is based on differences in the development of photon- and hadron-induced air showers after the shower maximum. A method which is sensitive only to the non-isotropic component of the diffuse photon flux yields an upper limit of Iγ/ICR (at 54 TeV) <2.0×10-3 (at the 90% confidence level) for a sky region near the inner galaxy (/20°< galactic longitude /<60° and /|galactic latitude /|<5°). A method which is sensitive to both the isotropic and the non-isotropic component yields global upper limits of Iγ/ICR (at 31 TeV) <1.2×10-2 and Iγ/ICR (at 53 TeV) <1.4×10-2 (at the 90% confidence level).