This study aims to present and apply an effective algorithm for solving the TFDE (Time-Fractional Diffusion Equation). The Chebyshev cardinal polynomials and the operational matrix for fractional derivatives based on these bases are relied on as crucial tools to achieve this objective. By employing the pseudospectral method, the equation is transformed into an algebraic linear system. Consequently, solving this system using the GMRES method (Generalized Minimal Residual) results in obtaining the solution to the TFDE. The results obtained are very accurate, and in certain instances, the exact solution is achieved. By solving some numerical examples, the proposed method is shown to be effective and yield superior outcomes compared to existing methods for addressing this problem.