The present invention provides a method of producing a heterocyclic compound useful as an agent for the prophylaxis and/or treatment of Alzheimer's disease and the like. The present invention relates to a method of producing 1,5-anhydro-2,4-dideoxy-2-(4-fluoro-5-methyl-1-oxo-6-(4-(1H-pyrazol-1-yl)benzyl)-1,3-dihydro-2H-isoindol-2-yl)-L-threo-pentitol or a salt thereof, which comprises reacting 4-fluoro-3-hydroxy-5-methyl-6-[4-(1H-pyrazol-1-yl)benzyl]-2-benzofuran-1(3H)-one or a salt thereof, 3-fluoro-2-formyl-4-methyl-5-[4-(1H-pyrazol-1-yl)benzyl]benzoic acid or a salt thereof, or a mixture thereof, with 2-amino-1,5-anhydro-2,4-dideoxy-L-threo-pentitol.