In the last five years, young people with college degrees have widened their earnings lead substantially over those without degrees, reversing a narrowing of the gap during the 1970s, the Census Bureau reported yesterday in a review of four decades of educational trends.

The bureau report also documented a substantial four-decade increase in the educational attainment of all Americans, particularly blacks.

In 1940, 38 percent of all persons aged 25 to 29 had completed high school, and the figure for blacks was 12.3 percent. By 1984, the overall proportion of graduates had risen to 86 percent, and for blacks to 79 percent.

Similar gains were shown in college education. In 1940, 6 percent of all persons 25 to 29 had completed college; by 1984 the figure was 22 percent. The proportion was slightly lower for women than for men. For blacks, the 1940 figure was 1.6 percent; this rose to 14.6 percent by 1984.

The bureau said that in 1983 the median income of male college graduates aged 25 to 34 was $21,988, or 39 percent higher than the median of those who had only a high school degree, which was $15,789. The bureau noted that the income differential, which was only 13 percent in 1950, had risen steadily to 28 percent in 1969, then unaccountably dropped to 21 percent over the next decade, but now is rising steadily. The 1970s drop might have been due in part to a glut of inexperienced baby-boom college graduates in the labor market, the bureau said.

Although the bureau cautioned that at least part of the collegians' differential may not be due to the added training but to differences in ability and demographic factors, a Gallup Poll released today shows that Americans believe overwhelmingly that a college degree is a lifetime ticket to better jobs and higher earnings.

The new poll found 64 percent saying a college education is very important, and 27 percent rating it fairly important. As recently as 1978, only 36 percent said it was very important. The major advantages cited were better jobs (52 percent), better opportunities (10 percent), specialized training (10 percent) and high income (18 percent). Only 14 percent said enhancing knowledge was the greatest advantage.

The Census Bureau study is a compendium of statistics showing trends in education since 1940. It found a vast enlargement of education -- the number of people completing high school and college, the money spent for it. The study concluded that educational improvement has been a major contributor to national economic growth.

It said that an analysis of college test scores led experts to conclude that their decline in the past generation was in part due to a decline in the quality of schooling, particularly after 1970 or so. As remedies, these authorities advocated "more homework, less absenteeism, more challenging courses and higher-demand-level textbooks."

The trends in educational achievement "have made the American people the most educated in the world," the bureau said. Comparing other countries in 1980-81, the most recent years available, the bureau found that 32 percent of Americans over 24 had obtained some college education, almost double the figure for the next closest countries, East Germany (17.3 percent) and Canada (17.2 percent), and well ahead of Sweden (15.5 percent) and Japan (14.5 percent).