The simulation of the diffraction contrast in x-ray topography has been extended from conventional crystals to quasicrystals (QCs). Case studies are presented for the investigation of two kinds of typical defects, i.e. spherical inclusions and straight dislocations, in an Al–Pd–Mn icosahedral QC using the extended program. The good agreement between the simulated and experimental images for spherical inclusions validates the extension. The systematic simulation for straight dislocations employing both phonon and phason strain fields illustrates not only the contrast dependences on various parameters, i.e. Burgers vector, diffraction vector, wavelength, deviation from exact Bragg diffraction, etc, but also the important contribution from the phason component, which is peculiar for QCs and normally makes the experimental analysis much more complex. The calculation can be applied to any defect in QCs in general and be of help in the defect characterization by matching with the experimental images, as in conventional crystals.