The status of income distribution is economically important because other macroeconomic variables, especially savings rates, affect the amount of investment and aggregate demand in different markets, and are politically a measure of government efficiency in attracting voters. The present study aims to investigate the macroeconomic variables affecting inequality in income distribution in the two groups of middle-income countries and high-income countries based on the International Monetary Fund classification. For this purpose, the annual data of economic complexity, scientific productivity, political risk, economic risk, and financial risk and the period 2019-2000 and the panel method have been used. The results show that in high-income countries, increasing economic complexity and scientific productivity reduces income inequality, while in middle-income countries, increasing scientific productivity reduces income inequality, but increasing economic complexity increases income inequality. Reducing political risk in both groups reduces income inequality; While reducing financial risk reduces income inequality in high-income countries, it increases income inequality in middle-income countries. The impact of economic risk on income inequality is also negligible in high-income countries, while in middle-income countries the impact of economic risk on income inequality is very strong, and reducing economic risk in this group of countries strongly reduces income inequality.