The invention discloses a method for preparing rare ginsenoside by fermentation of ginseng endophyte. The method comprises the following steps of (1) cleaning the surface of the ginseng, removing bacteria, removing peel or root and whisker, slicing, and obtaining pure culture on a flat plate culture medium; (2) inoculating single or multiple colonies into a liquid fermentation culture medium for culturing for 4 to 14 days; (3) adding 1 to 1.5 volume of n-butanol into the fermentation liquid, fully and uniformly mixing, centrifuging, obtaining a supernatant, and concentrating and drying under the vacuum condition, so as to obtain the rare ginsenoside. The method has the advantages that the rare ginsenoside is produced by fermentation of ginseng endophyte, the growth cycle of the endophyte is short, the growth speed is quick, the culture is easy, the influence by environment factors is avoided, the culture medium is simpler, the content of secondary ginsenoside is high, and the method issuitable for industrialized production; by adding acetone acid, acetyl coenzyme A, sodium acetate and other precursor matters, and lovastatin, eugenol and other enzyme inhibitors, the rare ginsenoside Rg3 can be induced to produce.