In this study, an analytical solution based on the first-order shear deformation theory was performed for free vibration and buckling analysis of functionally graded porous beams (FGM-P) subjected to various boundary conditions. Also, this problem is solved by using finite element (FEM) and artificial neural network (ANN) methods. Here a Ritz-based analytical solution is used, and different polynomial series functions are proposed for each boundary condition. Lagrange's principle was used while deriving the equations of motion. A power-law rule describes the variation of the beam's materials in volume. The normalized fundamental frequencies and critical buckling loads are obtained for various boundary conditions, power-law index (k), slenderness (L/h), porosity coefficient (e), and porosity distribution (FGM-P1, FGM-P2). The polynomial series functions used in this study were verified with the literature, and the numerical results obtained were compared with FEM and ANN. The results obtained are quite compatible with each other.