In an ambush tied to West German terrorists, two rocket-propelled grenades and a volley of bullets were fired here this morning at a car carrying the commander of U.S. Army forces in Europe, severely damaging the rear of the armor-plated vehicle but leaving Gen. Frederick J. Kroesen largely unharmed.

The attack followed the bombing two weeks ago at the U.S. and NATO European air command center in Ramstein that injured 20 people. Coming on top of an increase in violence this year against U.S. facilities in West Germany, today's attack reinforced public and official concern about a resurgence of ultraleft terrorist activity and anti-American sentiment in this country.

"I don't know who is responsible," Kroesen said at a news conference after he was quickly treated at a local Army hospital for small cuts on the back of his neck from shattered glass. "But I know there's a group that's declared war on us and I'm beginning to believe it. They're trying to make this job less than fun."

Kroesen, 58, a four-star general who has been the Army commander here for more than two years, said he was referring to the Red Army Faction, the group that claimed responsibility for the Ramstein bombing as part of its fight against "U.S. imperialism."

The attack recalled an unsuccessful assassination attempt in Belgium two years ago in which a bomb was detonated under a bridge as Alexander M. Haig Jr., then supreme commander of NATO forces in Europe, drove across. Haig, now secretary of state, visited West Germany last weekend, and at least 50 police officers were injured in violent protests against the Reagan administration's military policies.

While no one immediately claimed responsibility for today's attack, West German authorities said they were going on the assumption it was the work of the Red Army Faction.

West German leaders condemned the incident. In a telegram to Kroesen, Chancellor Helmut Schmidt said, "All decent Germans must sharply condemn with me this terrorist attack."

The Bonn government issued a statement expressing its "determination to do everything to guarantee the security of the U.S. troops who are stationed in the Federal Republic for the protection of Western Europe."

The ambush showed signs of careful planning and professional execution. It occurred at 7:20 a.m. as Kroesen, his wife, Rowene, and the general's aide, Maj. Philip E. Bodine, were being driven into Heidelberg along the Neckar River from Kroesen's home in an eastern neighborhood of this picturesque central German city.

According to a senior West German investigator, two grenades flew out of the thick woods that mat a steep hill on the other side of the road.

One missed Kroesen's car, striking the sidewalk and causing a foot-deep hole. The other appeared to have penetrated the trunk of the armor-plated Mercedes, then exploded, blasting the trunk lid up and causing the rear window to shatter and collapse into the trunk.

The grenades are suspected of having been fired from halfway up the wooded slope, about 200 yards from the car.

Kroesen told reporters he was reading his morning messages when the explosions came. Police said the car had stopped at a pedestrian crossing, but Kroesen seemed to indicate it was moving at about 40 miles an hour when hit.

"The car stopped and I looked to see if my wife was all right," he said, "and waited to see what was going to happen next. We looked to see if everyone had arms and legs in order."

After the grenade explosions, Kroesen said, the car was hit by small arms fire, the source of which he could not see. The car showed several bullet holes.

Kroesen said a military escort car, trailing some distance behind, pulled up and police began to search the area. His driver, a West German police official, found the general's car could still move and drove the group to the hospital. Besides Kroesen's cuts and what he said was a little trouble with his hearing, there were no reported injuries.

Police searching the hillside found what they believe was the grenade launcher, a Soviet-made RPG7. The weapon is said to have an effective range of 300 yards.

Nearby, investigators found sleeping bags, the remains of a tent and a sports bag and food, suggesting that the assailants had camped above the attack site or were planning to camp there for some time. Near the tent was a transmitter with an aerial, which police suspect may have been used to coordinate the attack.

As of tonight, police reported finding no suspects.

The Red Army Faction, which West German authorities have claimed was much weakened by the deaths and jailings of its leaders in recent years, is now estimated to number 13 hard-core members, who draw on the support of about 500 sympathizers in West Germany. The faction is also believed by West German officials to have received training and support from the Palestine Liberation Organization in Lebanon.

Barracks at the U.S. Army headquarters in Heidelberg were the target of a bomb attack in 1972 by the Baader-Meinhof gang, the forerunner of the faction. Three soldiers died and six were wounded in that attack.

Kroesen, a tall man with a reputation as a quiet commander, appeared unworried by the prospect of a new wave of anti-American terrorism in West Germany. Asked if he intended to order new security measures, he said jokingly, "I have the understanding with my provost marshal that if anything happens to me, it's his fault."

In answer to questions, Kroesen said he usually follows the same 15-minute route to work each day since there are few alternatives, although he said he rides in different cars.

After the attack, Kroesen followed through with a full schedule of activities, including a tour of major NATO exercises under way in West Germany, although security was increased at the Heidelberg headquarters.