We build an agent-based model populated by households with heterogenous and time-varying financial conditions in order to study how fiscal multipliers can change over the business cycle and are affected by the state of credit markets. We find that deficit-spending fiscal policy dampens the effect of bankruptcy shocks and lowers their persistence. Moreover, the size and dynamics of government spending multipliers are related to the degree and persistence of credit rationing in the economy. On the contrary, in presence of balanced-budget rules, output permanently falls below pre-shock levels and the ensuing multipliers fall below one and are much lower than the ones emerging from the deficit-spending policy. Finally, we show that different conditions in the credit market significantly affect the size and the evolution of fiscal multipliers.