  We consider the final state problem for the inhomogeneous nonlinear
Schr\"odinger equation with a critical long-range nonlinearity. Given a
prescribed asymptotic profile, which has a logarithmic phase correction
compared with the free evolution, we construct a unique global solution which
converges to the profile. As a consequence, the existence of modified wave
operators for localized small scattering data is obtained. We also study the
same problem for the case with the critical inverse-square potential under the
radial symmetry. In particular, we construct the modified wave operators for
the long-range nonlinear Schr\"odinger equation with the critical
inverse-square potential in three space dimensions, under the radial symmetry.
