Objective To study the effect of metformin combined with vitamin D in patients with diabetes mellitus complicated with osteoporosis.Methods A total of 98 patients with diabetes mellitus complicated with osteoporosis ad-mitted to Hui'an County Hospital from June 2022 to December 2023 were selected as the research objects.They were divided into two groups according to different treatment methods,with 49 cases in each group.The control group was treated with repaglinide+vitamin D drops,and the study group was treated with metformin on the basis of the control group.The blood glucose levels,bone mineral density,bone metabolism indexes and quality of life were compared be-tween the two groups.Results After treatment,the levels of fasting blood glucose,2-hour postprandial blood glucose and blood phosphorus in the study group were lower than those in the control group,and the levels of bone mineral density,blood calcium,osteocalcin and quality of life scores were higher than those in the control group,the differ-ences were statistically significant(all P<0.05).Conclusion The application of metformin combined with vitamin D in patients with diabetes mellitus complicated with osteoporosis can reduce blood glucose levels and improve quality of life.It is an effective treatment plan.