Astragalus adsurgens (A. adsurgens), which is considered a forage in China, grows widely in Eurasia and North America. However, Alternaria gansuense (A. gansuense) (synonym: Embellisia astragali) systematically infects A. adsurgens, producing swainsonine (SW), which poisons domesticated animals. In this study, we hypothesized that the A. gansuense SW-producing fungus is morphologically and molecularly related to the locoweed endophyte, Alternaria oxytropis (A. oxytropis), which systematically grows in host plants. Therefore, pure cultures of the fungi from diseased plants or endophytic interactions were collected from fields and assayed for SW via high-performance liquid chromatography linked to mass spectroscopy (HPLC-MS). The production of SW was also detected in A. adsurgens, A. oxytropis and diseased plants by assaying for the presence of the β-ketoacyl synthase (KS) gene, which is required for SW synthesis. Diseased A. adsurgens and pure cultures of A. gansuense have SW and the healthy-looking A. adsurgens plants also contained SW, probably because they were infected with A. gansuense. Therefore, A. adsurgens-infected A. gansuense are not safe for livestock consumption.