Johns Hopkins University in Baltimore was selected yesterday as the site for the Space Telescope Science Institute, a choice that promises to make Hopkins one of the astronomy capitals of the world for the next 30 years.

The choice of Hopkins was made by National Aeronautics and Space Administration chief Robert A. Frosch, acting on the recommendation of a specially appointed source evaluation board that had discussed the merits of Hopkins and its main competitor, Princeton University, behind closed doors for the past week. Competition in academic circles for the site of the Space Telescope Science Institute was as fierce as it is in the aerospace industry for a major new airplane or spacecraft.

"There is true excitement in the prospect that Baltimore will now become the world capital of astronomy," Dr. Steven Muller, president of Johns Hopkins, said yesterday. "The space observations to be conducted by the institute in the years ahead are among the most significant undertakings in the entire history of astronomical research."

The institute will direct the use of a unique orbiting observatory called the Large Space Telescope -- five tons of optics costing $1 billion that is to be carried into earth orbit by the space shuttle in late 1984 or early 1985 to peer at the stars for the next 30 years.

The Large Space Telescope will have a lens 95 inches wide, less than half the size of the 200--inch telescope on the top of Mt. Palomar in California. But placed beyond the earth's atmosphere, the big orbiting eye will be able to see 10 times farther into the heavens and scan 1,000 times more of the sky than Palomar does.

It will spot new stars, individual stars inside star clusters and nebulae, the remnants of dead and destroyed stars, and possibly even planets circling nearby stars -- planets beyond the sight of earthbound telescopes.

"It will unlock the heavens the way the microscope unlocked the cell," said Dr. Arthur C. Code of the University of Wisconsin, who has been named the first acting director of the new institute. "The difference is, this will be on a far grander scale."

Hopkins will finance construction of a $6 million building, which will house three enormous computers and the offices of as many as 40 astronomers from all over the world who are to be hand--picked by their peers. The computers will help to choose star targets, aim the telescope, store star histories and record every new piece of information about a star sent back by the orbiting telescope.

One reason Hopkins won out in the institute sweepstakes over Princeton is that it had the backing of the Association of Universities for Research in Astronomy, which traditionally had directed the use of most of the nation's large optical telescopes. Another reason that Hopkins won is its proximity to the Goddard Space Flight Center in Greenbelt, Md., where data from the telescope will be received.

The cost and availability of housing, plus accessibility to a major airport, also were reasons that Hopkins won. The institute is expected to receive more than 200 visiting astronomers every year.