We consider a contribution of microlensing to the X-ray variability of high-redshifted QSOs . Such an effect could be caused by stellar mass objects ( SMO ) located in a bulge or/and in a halo of this quasar as well as at cosmological distances between an observer and a quasar . Here , we not consider microlensing caused by deflectors in our Galaxy since it is well-known from recent MACHO , EROS and OGLE observations that the corresponding optical depth for the Galactic halo and the Galactic bulge is lower than 10 ^ { -6 } . Cosmologically distributed gravitational microlenses could be localized in galaxies ( or even in bulge or halo of gravitational macrolenses ) or could be distributed in a uniform way . We have analyzed both cases of such distributions . As a result of our analysis , we obtained that the optical depth for microlensing caused by stellar mass objects is usually small for quasar bulge and quasar halo gravitational microlens distributions ( \tau \sim 10 ^ { -4 } ) . On the other hand , the optical depth for gravitational microlensing caused by cosmologically distributed deflectors could be significant and could reach 10 ^ { -2 } -0.1 at z \sim 2 . This means that cosmologically distributed deflectors may contribute significantlly to the X-ray variability of high-redshifted QSOs ( z > 2 ) . Considering that the upper limit of the optical depth ( \tau \sim 0.1 ) corresponds to the case where dark matter forms cosmologically distributed deflectors , observations of the X-ray variations of unlensed QSOs can be used for the estimation of the dark matter fraction of microlenses .