The invention discloses a method for preparing a three-dimensional carbon framework embedded nano platinum-based alloy catalyst, and aims to solve the problems that a conventional Pt-based catalyst is low in activity, poor in stability and Pt utilization rate. According to the method, in the growth process of a zeolite imidazolate framework structural material (ZIF), Pt nanoparticles modified by a surfactant are uniformly wrapped in a ZIF structure, the high-temperature reduction process is precisely regulated, the ZIF carbonization, metal reduction and alloying process is controlled, and thus a catalyst structure of a three-dimensional carbon framework embedded nano platinum alloy is constructed. According to the method, the structural shrinkage effect of the carbonization process is smartly utilized, the ZIF structure is converted into a three-dimensional through carbon framework pore structure, the range limiting function of a ZIF framework at high temperature is smartly utilized, platinum particles and metal ions in the ZIF structure are subjected to in-situ alloying and embedded into the framework structure, then the three-dimensional catalyst of a pore-communicated framework and a nano-grade platinum alloy particle embedded structure is formed, the activity and the stability of the catalyst are greatly improved, and the utilization rate of Pt is greatly increased.