The inclusive production of D mesons in two-photon collisions is measured with the ALEPH detector at e+e- centre-of-mass energies from 183 GeV to 209 GeV. A total of D meson events are observed from an integrated luminosity of 699pb-1. Contributions from direct and single-resolved processes are separated using the ratio of the transverse momentum of the D to the visible invariant mass Wvis of the event. Differential cross sections of D production as functions of and the pseudorapidity are measured in the range 2 GeV GeV/c and . They are compared to next-to-leading order (NLO) perturbative QCD calculations. The extrapolation of the integrated visible D cross section to the total charm cross section, based on the Pythia Monte Carlo program, yields pb .