The invention discloses an ecological pig fodder and a preparation method thereof and belongs to the field of livestock feeding. The ecological pig fodder is prepared from, by mass, 20-30 parts of corn flour, 15-20 parts of bean flour, 4-6 parts of wheat bran, 3-5 parts of straw powder, 2-5 parts of algae powder, 1-2 parts of shellfish powder and 0.3-0.5 part of compound enzyme. The finally prepared feed is cake-shaped, granular or powdery through raw material preprocessing, mixing, stirring, forming and other steps. An ecological pig fodder design principle is adopted, raw materials are wide in source, the breeding cost is reduced, the feeding amount of pigs is increased to the great degree, the growth efficiency of the pigs is improved, and meat is also greatly improved. In addition, the immunity of the pigs is improved, disease occurrence rate is reduced, and the economic benefits of pig raising are increased.