Variations in the brain's blood oxygenation and deoxygenation reflect neuronal activation patterns, and can be measured using functional near infrared spectroscopy (fNIRS). We aim to utilize fNIRS to obtain insights into the dynamic functional connectivity of the brain as a function of the mental workload. Interpreting connectivity in the brain using noisy fNIRS data with low signal to noise ratio is challenging. To overcome the challenges with fNIRS data, we use a hierarchical latent dictionary learning approach. This approach provides covariance matrices to obtain the dynamic functional connectivity and neuronal activation patterns that change over time. We use features from the dynamic functional connectivity of the brain reflected in fNIRS data collected from the prefrontal cortex to investigate mental workload. In particular, we study three types of mental workload tasks called n-back tasks and perform binary classification for each n-back task compared to the other n-back tasks and rest condition using support vector machines. The results of our binary classification of various n-back tasks compared to the rest condition outperforms binary classification results reported previously.