Secoisolariciresinol diglucoside (SDG) and tracheloside (TCL) are the main lignan components of flaxseed cake and safflower seed cake, which are by‐products of oil extraction. Both SDG and TCL are metabolized into mammalian lignan enterolactone (EL) with the involvement of intestinal bacteria. In this research, we evaluated the anti‐osteoporosis effects of SDG and the in vivo metabolites EL and enterodiol (ED) prepared in our previous work, as well as the newly isolated chemical constituents from safflower seed, including TCL, the lactone ring opening product of TCL (OTCL) and two alkaloids on the alloxan‐induced zebrafish model. All the compounds showed significant anti‐osteoporosis effects at 80 µM, with p < 0.05 for EL and p < 0.001 for other compounds compared with the model. SDG and TCL showed the most significant and concentration‐dependent effects, with p < 0.001 compared with model at 20 µM. The alkaloids, N‐coumaroylserotonin glucoside and N‐feruloylserotonin glucoside, also showed anti‐osteoporosis at 20 µM with p < 0.01, whereas EL, ED, and OTCL showed no significant effects. Quantitative real‐time polymerase chain reaction revealed that SDG and TCL upregulated the expression of osteogenic genes Runx2, SP7, OPG, Col1a1a, Alp, ON, OPN, and OCN in alloxan‐treated zebrafish. The in vivo metabolite of lignans, EL, showed significant anti‐inflammatory effect (p < 0.01) at 20 µM, which might also help to combat osteoporosis and other complications caused by excessive immune response in the body. The results provided scientific data for using the oil extraction by‐products as sources of anti‐osteoporosis compounds.Practical ApplicationThis study found that lignans in flaxseed cake and safflower seed cake exhibited anti‐osteoporosis effects by upregulating the expression of osteogenic genes, making the oil extraction by‐products sources of anti‐osteoporosis compounds.