We report a measurement of the $ u_mu$ inclusive charged current cross sections on iron and hydrocarbon in the T2K on-axis neutrino beam. The measured inclusive charged current cross sections on iron and hydrocarbon averaged over the T2K on-axis flux with a mean neutrino energy of 1.51 GeV are $(1.444pm0.002(stat.)_{-0.157}^{+0.189}(syst.))times 10^{-38}mathrm{cm}^2/mathrm{nucleon}$, and $(1.379pm0.009(stat.)_{-0.147}^{+0.178}(syst.))times 10^{-38}mathrm{cm}^2/mathrm{nucleon}$, respectively, and their cross section ratio is $1.047pm0.007(stat.)pm0.035(syst.)$. These results agree well with the predictions of the neutrino interaction model, and thus we checked the correct treatment of the nuclear effect for iron and hydrocarbon targets in the model within the measurement precisions.