This paper presents the derivation and numerical solutions of a 3D dynamic model for analyzing the behavior of sucker-rod pumping installations in deviated wells. Using differential geometry and variational methods, the rod dynamics in deviated wells is presented by the set of six coupled differential equations with their boundary conditions. The paper describes the fundamental assumptions and simplifications which can be used in the numerical solution. A computer program based on the model is developed and applied to determine the downhole conditions and to predict the rod behavior in the deviated well. A number of wells are examined. Good Agreement is shown by comparing the computed results with the field measurements.