Efficient resource allocation via routing, modulation, and spectrum allocation (RMSA) is critical for elastic optical networks (EONs). While analytical relative cost models have shown promise for adaptive RMSA, they often suffer from high computational complexity and restrictive assumptions that limit practical applicability. In this study, we present a neural-network (NN)-based approach that learns the relative cost function directly from data. The proposed method eliminates the need for iterative optimization and specialized teletraffic modeling, offering a more flexible and accurate estimate of the trade-off between immediate and future network revenue. We describe the systematic generation of a large-scale simulation dataset, the design of a feature set capturing link states and spectral fragmentation, and the training of a robust NN model. Extensive evaluations on the NSFNET and COST239 topologies demonstrate that the proposed neural-network-based RMSA algorithm reduces the blocked bandwidth ratio (BBR) by an average of $34\%$ while improving fairness by $70\%$ compared to established benchmarks. The model’s adaptability and offline training paradigm highlight its potential for deployment in operational networks.