Mathematical models have predicted for some years now that a buildup of carbon dioxide from the burning of fossil fuels such as coal and oil and other gases emitted by human activities into the atmosphere would cause the earth's surface to warm by trapping infrared radiation from the sun, turning the entire earth into a kind of greenhouse.

If the current pace of the buildup of these gases continues, the effect is likely to be a warming of 3 to 9 degrees Fahrenheit from the year 2025 to 2050, according to these projections. This rise in temperature is not expected to be uniform around the globe but to be greater in the higher latitudes, reaching as much as 20 degrees, and lower at the Equator.

The rise in global temperature is predicted to cause a thermal expansion of the oceans and to melt glaciers and polar ice, thus causing sea levels to rise by one to four feet by the middle of the next century. Scientists have already detected a slight rise in sea levels. At the same time, heat would cause inland waters to evaporate more rapidly, thus lowering the level of bodies of water such as the Great Lakes.

Dr. Hansen, who records temperatures from readings at monitoring stations around the world, had previously reported that four of the hottest years on record occurred in the 1980's. Compared with a 30-year base period from 1950 to 1980, when the global temperature averaged 59 degrees Fahrenheit, the temperature was one-third of a degree higher last year. In the entire century before 1880, global temperature had risen by half a degree, rising in the late 1800's and early 20th century, then roughly stabilizing for unknown reasons for several decades in the middle of the century. Warmest Year Expected

In the first five months of this year, the temperature averaged about four-tenths of a degree above the base period, Dr. Hansen reported today. ''The first five months of 1988 are so warm globally that we conclude that 1988 will be the warmest year on record unless there is a remarkable, improbable cooling in the remainder of the year,'' he told the Senate committee.

He also said that current climate patterns were consistent with the projections of the greenhouse effect in several respects in addition to the rise in temperature. For example, he said, the rise in temperature is greater in high latitudes than in low, is greater over continents than oceans, and there is cooling in the upper atmosphere as the lower atmosphere warms up.

''Global warming has reached a level such that we can ascribe with a high degree of confidence a cause and effect relationship between the greenhouse effect and observed warming,'' Dr. Hansen said at the hearing today, adding, ''It is already happening now.''