This study aims to determine the natural frequencies of axially functionally graded porous material (FGPM) beams with non-uniform cross-sections under a variety of boundary conditions. Two types of pore distribution were used: even and uneven. Initially, an analytical method was used to determine the natural frequencies of FGPM beams with different cross-sections. The Fredholm integral approach was used to obtain the characteristic equations. Furthermore, the collected results are confirmed and compared to the existing literature. The artificial neural network (ANN) technique is then used to predict the fluctuations in the natural frequency of a clamped–simply supported axially FGPM beam with a non-uniform cross-section. The prediction of natural frequencies by ANN is based on a large dataset of over 1[Formula: see text]100 data points acquired from the analytical solution obtained in this study and data available in the literature. This research conducts a parametric analysis to evaluate the influence of numerous aspects, including as beam characteristics, material properties, geometric details, gradient parameters, and porosity distribution, on functionally graded (FG) beam vibration behavior. Finally, both ANN and computational analysis demonstrate that porosity distributions and non-uniform cross-sectional area have a substantial effect on the natural frequencies of axially FG beams.