Provided is a method for producing a heterocyclic compound which is useful as a prophylactic and/or therapeutic agent for Alzheimer's disease and the like. A method for 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, comprising 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.