The invention discloses a melamine selective electrode and a preparation method thereof, and the electrode comprises a substrate electrode which is coated with a poly-o-toluidine (POT) membrane on the surface, a polymethyl methacrylate-dimethylaminoetyl methacrylate (PMMA-PDMA) sensitive membrane with an electroactive substance, a glass cannula, epoxy resin, and a wire. The melamine selective electrode provided by the invention has an all-solid-state form, uses a PMMA-PDMA copolymer membrane without any plasticizer to overcome the disadvantages of a traditional PVC membrane of difficult adhesion, easy leakage, poor thermal stability, and the like, uses a POT membrane to inhibit the water layer formation between the sensitive membrane and the substrate electrode, and has the advantages of being stable in measuring voltage, low in detection limit, simple in structure, convenient to use, capable for miniaturization, etc. The detection of melamine in milk and dairy products by using the melamine selective electrode provided by the invention as an indicator electrode and adopting a potential analysis method has high sensitivity, good selectivity, quick detection speed, simple equipmentrequired, low analysis cost, and can realize on-site detection.