The elastic strain and stress fields associated with nanoscale compositional modulation in an anisotropic epitaxial film on an anisotropic substrate are obtained by using Stroh formalism and the Eshelby-type inclusion method. The composition of the epitaxial film is considered to periodically fluctuate in a surface soft mode, with the amplitude of the composition modulation maximal near the growing surface and decreasing exponentially into the film. It has been experimentally observed that the composition modulation affects the formation of a new type of crystal defects, i.e., misfit dislocation dipoles, in III-V compound semiconductor materials. The formation energy of a misfit dislocation dipole under the elastic fields due to the composition modulation is calculated in this study. It is composed of the core and self energies of two dislocations, the interaction energy between two dislocations, and the interaction energies between the composition modulation and two dislocations. Numerical calculations are performed for a dislocation dipole in a lattice-matched Ga 0.5 In 0.5 P film on a GaAs substrate.