The anisotropic complex dielectric response was accurately extracted from spectroscopic ellipsometry measurements at phonon frequencies for the three principal crystallographic directions of an orthorhombic (Pbnm) YTiO_3 single crystal. We identify all twenty five infrared-active phonon modes allowed by symmetry, 7B_1u, 9B_2u, and 9B_3u, polarized along the c-, b-, and a-axis, respectively. From a classical dispersion analysis of the complex dielectric functions tildeepsilon(omega) and their inverses -1/tildeepsilon(omega) we define the resonant frequencies, widths, and oscillator strengths of the transverse (TO) and longitudinal (LO) phonon modes. We calculate eigenfrequencies and eigenvectors of B_1u, B_2u, and B_3u normal modes and suggest assignments of the TO phonon modes observed in our ellipsometry spectra by comparing their frequencies and oscillator strengths with those resulting from the present lattice-dynamics study. Based on these assignments, we estimate dynamical effective charges of the atoms in the YTiO_3 lattice. We find that, in general, the dynamical effective charges in YTiO_3 lattice are typical for a family of perovskite oxides. By contrast to a ferroelectric BaTiO_3, the dynamical effective charge of oxygen related to a displacement along the c-axis does not show the anomalously large value. At the same time, the dynamical effective charges of Y and ab-plane oxygen exhibit anisotropy, indicating strong hybridization along the a-axis.