The invention provides a method and device for testing axial rigidity and radial rigidity of a rotary hydrostatic guide rail. A rotary guide rail seat is fixed on a platform, a pressing plate and a rotary assembly are fixedly connected to form a rotary part, and the rotary part is used for guiding in a rotary motion way by depending on a hydrostatic guide rail pair; an axial load assembly comprises a flange sleeve, a screw rod, a thrust bearing, a radial bearing, a sleeve, a connecting piece, force sensors and a terminal pad which are vertically arranged; a radial load assembly comprises a flange sleeve, a screw rod, a thrust bearing, a radial bearing, a sleeve, a connecting piece, a force sensor, a loading piece and a connection bending plate which are horizontally arranged; and a mounting support of a displacement sensor assembly is fixed on the rotary guide rail seat, and a measuring head aligns to the rotary assembly. The method and device provided by the invention can be used for acquiring the axial and the radial rigidity data of the hydrostatic guide rail in a rotary motion and can also be used for an confirmatory experiment on a method for analyzing the rigidity of the hydrostatic guide rail in the rotary motion and the influence of oil film tangential adhesive force.