We present the generalized iterative residual fitting (IRF) for the computation of the spherical harmonic transform (SHT) of band-limited signals on the sphere. The proposed method is based on the partitioning of the subspace of band-limited signals into orthogonal subspaces. There exist sampling schemes on the sphere which support accurate computation of SHT. However, there are applications where samples~(or measurements) are not taken over the predefined grid due to nature of the signal and/or acquisition set-up. To support such applications, the proposed IRF method enables accurate computation of SHTs of signals with randomly distributed sufficient number of samples. In order to improve the accuracy of the computation of the SHT, we also present the so-called multi-pass IRF which adds multiple iterative passes to the IRF. We analyse the multi-pass IRF for different sampling schemes and for different size partitions. Furthermore, we conduct numerical experiments to illustrate that the multi-pass IRF allows sufficiently accurate computation of SHTs.