The invention discloses a preparation method and application of a carbon molecular sieve for separating olefin and alkane. The method comprises the following steps of: adding a starch carbon precursor into a distilled water solvent to prepare a starch aqueous solution, uniformly stirring and dispersing, and then carrying out medium-pressure medium-temperature hydrothermal controllable polymerization and dehydration carbonization reaction in a reaction kettle to obtain homogeneous carbonaceous microspheres; and washing and drying the obtained carbonaceous microspheres, performing controlled high-temperature defunctionalization treatment at 700-1000 DEG C in an inert atmosphere, and controlling carbon layer rearrangement and heteroatom pyrolytic reaction to obtain the carbon molecular sieve material with uniform and adjustable ultra-microporous channels. Starch biomass which is low in price, non-toxic and harmless serves as a carbon source, carbonaceous microspheres are formed through a direct hydrothermal polymerization carbonization process, the defect content and the graphitization degree of the microspheres can be controlled by adjusting the reactant concentration, the carbon molecular sieve is obtained through pyrolysis at a corresponding calcination temperature, and fine adjustment of the aperture within a sub-angstrom precision range is realized.