The 5-aza-6-deoxy analogue of castanospermine (+/-)-5a and its 1-epimer (+/-)-5b was synthesized. The synthesis started from the known compound 5-benzyloxy-7-hydroxyhepta-1,3-diene, which was protected and subjected to Diels-Alder reaction with 4-phenyl-1,2,4-triazoline-3,5-dione to give two epimeric adducts. One of these was transformed through epoxidation, acetolysis, a series of side-chain transformations that converted it into a terminally protected aldehyde, deprotection, and hydrogenolysis/reductive amination into 5a. By a similar set of reactions the other adduct epimer was converted into 5b. The castanospermine analogue 5a was a weaker inhibitor of almond beta-glucosidase and rice alpha-glucosidase than castanospermine (2) or 1-azafagomine (4), but was considerably more potent than its epimer 5b. This suggests that these enzymes have a strong preference for binding substrates or azasugars with the 6-OH in an axial conformation.