Functional near-infrared spectroscopy (fNIRS), renowned for its high spatial resolution, shows substantial promise in brain-computer interface (BCI) applications. However, challenges such as lengthy data acquisition processes and susceptibility to noise can limit data availability and reduce classification accuracy. To overcome these limitations, we introduce the CosineGAN-transformer network (CGTNet), which integrates a dual discriminatorGANfor generating high-quality synthetic data with a Transformer-based classification network. Equipped with a multi-head self-attention mechanism, this network excels at capturing the intricate spatiotemporal relationships inherent in high-resolution fNIRS signals. The dual discriminator framework ensures that both the temporal and spatial aspects of the synthetic data closely resemble the original signals, thereby enhancing data diversity and fidelity. Experimental results on a publicly available fNIRS dataset, comprising 30 participants performing motor imagery tasks (right-hand tapping, left-hand tapping, and foot tapping), demonstrate that CGTNet achieves an accuracy of 82.67%, outperforming existing methods. Key contributions of this work include the use of multi-head self-attention for refined feature extraction and a dual discriminator Generative Adversarial Networks (GAN) framework that maintains data quality and consistency. These advancements significantly improve the robustness and accuracy of BCI systems, offering promising applications in neurorehabilitation and assistive technologies.