The polyhydroxylated indolizidines castanospermine and swainsonine as well as some of their stereoisomers are powerful glycosidase inhibitors. An efficient and stereochemically flexible synthesis of racemic 1,7,8-trihydroxylated and 1,6,7,8-tetrahydroxylated indolizidines (castanospermine stereoisomers) from readily available N-substituted γ-oxygenated α,β-unsaturated sulfones 3 and 4 has been developed. The construction of the bicyclic skeleton of 1-hydroxyindolizidine has been accomplished by intramolecular conjugate addition of the nitrogen moiety of 3 and 4 to the α,β-unsaturated sulfone unit to give the pyrrolidine intermediates 5 and 6, followed by formation of the C(7)−C(8) bond by intramolecular acylation (or alkylation) of the α-sulfonyl carbanion. The stereoselectivity of the pyrrolidine synthesis was highly dependent on the bulkiness of the γ-oxygenated function; thus, the free alcohols gave predominantly cis-pyrrolidines while the OTIPS derivatives led to the trans isomers. After straightforward functional group transformations, the removal of the sulfonyl group at C(8) either by Julia reaction or by basic elimination (depending on the substrate used) afforded the key C(7)C(8) unsaturated indolizidines 10, 22, 30, and 31, whose stereoselective dihydroxylations with OsO4 gave a variety of cis C(1)C(8a) and trans C(1)C(8a) trihydroxylated and tetrahydroxylated indolizidines, among which (±)-1,7-di-epi-castanospermine and (±)-1,8-di-epi-castanospermine have been reported for the first time.