The invention relates to epoxy silsesquioxane/epoxy resin hybridized glue for packaging photoelectric devices and a preparation method thereof. The hybridized glue is prepared by mixing substrate resins, a curing agent and other components, wherein other components comprise the following materials in mass percentage: 12%-18% of modified epoxy silsesquioxane, 36%-42% of bisphenol A type epoxy resins, 30%-38% of polyamide, 5%-10% of N,N-diaminodiphenyl-methane and 0.5%-1.5% of triethylamine, and the structural formula of the modified epoxy silsesquioxane is shown in the specification, wherein Ris shown in the specification. The epoxy silsesquioxane synthesized in the method has high molecular weight, the maximum-average molecular weight reaches 1.1*10<6>, and the weight-average molecular weight reaches 1.21*10<6>. The prepared glue has the advantages of the epoxy silsesquioxane and the epoxy resins and has good heat resistance, cold resistance and corrosion resistance, high bonding performance, low curing contraction rate, good electrical performance, simple preparation process and easy operation of a preparation process, and excellent ultraviolet radiation resistance, chemical corrosion resistance and mechanical performance, wherein the electrical performance achieves the packaging requirements on the photoelectric devices.