An optical head device whereby writing of information and/or reading out of information is carried out by irradiating an optical recording medium with light from a light source, through a diffracting element, wherein the diffracting element is provided with an optically anisotropic diffraction grating having lattice-like projections and recesses formed on the surface of a transparent substrate, and said projections and recesses are filled with a liquid crystal having an optical anisotropy, and at least the projections among the projections and recesses are formed by a transparent thin film made of SiOxNy (0≦x<2, 0≦y<1.3), provided on the surface of the transparent substrate, wherein a phase difference element is laminated on the liquid crystal side of the optically anisotropic diffraction grating to constitute the diffracting element, the phase difference element being a phase difference sheet or phase difference film, at least one side of which is covered by an organic resin, and the phase difference sheet or phase difference film being sandwiched with transparent flat substrates.