Lablab bean (Lablab purpureus L.), known for its higher protein content provides a promising alternative to reduce reliance on animal-based proteins and support sustainable agriculture. Nowadays, traditional methods for nutritional profiling have been outperformed by Convolutional Neural Networks (CNNs) integrated with Near-Infrared Reflectance Spectroscopy (NIRS). However, an advanced technique called Transformers, despite their potential, remains underexplored for prediction of key quality traits of crops. Thus, in the present study, we aimed to predict lablab bean protein content using a Transformer-based model (termed ProTformer) coupled with NIRS. The Dumas combustion method was used to determine protein content from 112 lablab bean genotypes. The performance of this model was compared with 1D CNN and Modified Partial Least Squares (MPLS)-based models. These models were evaluated using the Coefficient of Determination (RSQ), Residual Prediction Deviation (RPD), bias, and Corrected Standard Error of Prediction (SEP(C)). Our findings show that the Transformer-based model achieved the highest predictive accuracy (RSQ = 0.977, RPD = 13.92), surpassing the 1D CNN (RSQ = 0.956, RPD = 11.33) and MPLS (RSQ = 0.943, RPD = 10.53)- based models by 22.86% and 32.21% in RPD, respectively. The multi-head self-attention mechanism present in the Transformer-based model enables it to concurrently focus on different spectral regions, resulting in superior predictive performance. This study shows the potential of using Transformer-based models coupled with NIRS for nutritional profiling which could be effectively adapted for other crops for rapid screening of large germplasm available at global repositories.