The Sandinistas have launched a large offensive against their rebel adversaries here in the northern mountains, but we were told the road was free of contra guerrillas and our ride with a military convoy would almost certainly be uneventful.

In the past, Sandinista officials maintained that the front line in their war against these rebels, who were organized and funded by the CIA, was too dangerous for foreign correspondents, although they did allow journalists for their own publications to cover combat units.

But the policy has changed in recent weeks and on Monday, with five other journalists, I found myself in a heavily protected convoy about three miles north of the village of Telpaneca.

We were driving slowly through the densely wooded hillsides when we were ambushed from three sides. For 40 minutes I huddled inside a Soviet-made tank with its cannon firing inches from my head.

When our journey began, about 20 Sandinista militiamen were riding atop two tanks. Another 20 militiamen were following in two green military supply trucks. We had been heading toward a military command post about five miles away, where the tanks and their 76-mm cannons were to reinforce about 800 Sandinista soldiers engaged with about 400 rebels.

Commander Manuel Salvatierra, in charge of the Sandinista offensive, said his troops were trying to inflict high numbers of casualties on the contras to force most of the rebel forces to retreat from the coffee zones. This would allow the government to move coffee pickers into these zones to save the harvest, which provides about a third of the country's foreign exchange.

I had put on a tankman's leather helmet, to protect my hearing in case the cannon had to be used, and ducked into the tight confines of the tank.

Lying on my back, I was wedged against the front bulkhead almost cheek to cheek with the tank driver, Miguel Angel Medrano, 23. He also had his leather helmet buttoned tight around his chin. He was watching the road through three small bulletproof windows, and steering the tank by fits and starts, hauling levers that control the speed of the tank treads. Sometimes he stuck his head out the open hatch to get a better view.

The other two crewmen were Carlos Barrero, 23, crew chief and artilleryman, and his assistant, Jose Ramon Calero, 19, in charge of ammunition. They had the main hatch open, and were sitting above me on the edge, enjoying the ride.

I had seen the barrels of the cannon and the 50-mm machine gun outside the tank. Now I saw the breech of the cannon, the black metal body of the machine gun and the metal ammunition belt loaded with shells curling out of the gun and disappearing into a metal box on the floor.

There was no conversation because of the great rumbling noise of the tank. So I made unsuccessful attempts to read the Russian labels on the dials next to me, counted the brass-tipped cannon shells -- 40 of them, more than a foot long -- and looked up at the two tankmen sitting on the hatch cover, and envying them their breeze.

Suddenly everything changed. The two men above me plunged down into the tank and I heard a loud noise on all sides.

The piece of blue sky above me went black as the hatch was slammed shut. Medrano, the driver, just 18 inches from me, also slammed shut his hatch. Now he was grimacing through his three small windows, with a look of fear and anger, pulling wildly at the gears as Barrero screamed at him.

"Where are they? Where are they?"

"They're right in front of us. Right in front. The sons of bitches," screamed the driver. "Give them the cannon, the cannon."

I realized then that the sound that engulfed me was the sound of bullets hitting the tank, like taps from a hammer against the metal, but many of them, like rain. We had been ambushed.

I thought of the people who had been riding atop the tank, but now there was no way to know what was happening to them. I found out later that the tanks had just been entering a sweeping mountain curve when rebels in three positions along the road and across a gulch had opened up on the convoy. The militiamen on top had dived into a culvert.

Inside, I had to put my legs up suddenly because the turret was turning and Barrero was cranking the barrel down while Medrano continued to scream at him.

"On the road ahead; they're running on the road ahead." Barrero pulled at the leather pouch filled with sand tied to the cannon trigger and the first cannon blast sounded. The cannon recoiled, a great flame leaped out the back and the cannon seemed to leap forward and then jump back. There was a smell of powder in the confined compartment and smoke mixed with the screaming.

An empty cannon shell fell into an asbestos bag at my knee, the same bag that had caught the flame of the cannon blast. Calero, the munitions man, slammed another shell into the breech, as Barrero swiveled the turret and Medrano, squinting fiercely through his three windows, shouted that they should level the house just above them.

"Hit the house. That's where they're hiding," he yelled. The cannon sounded again and the tank rocked. Sandinista troops later said they had seen the blast and that the house, which they said had been abandoned by its owners earlier in this guerrilla war, had been demolished.

The radios built into the leather helmets were not working and Medrano and Barrero, who was using a sight built into his hatch, continued to scream at each other at the top of their lungs, as they saw contras on all sides.

Medrano took the tank farther up the road, where he had seen the blue uniforms of the rebels, and Barrero continued to blast away at the densely wooded hills. The impact of the bullets on the outside of the tank had stopped, the contras apparently having given up trying to penetrate it with small-arms fire. But suddenly the tank took a jolt that shook it for the first and only time in the ambush.

Barrero looked frightened.

"What was that?" he screamed, swiveling the turret all around and scanning the mountainside.

"It was a monkey," screamed Medrano, using Sandinista slang for a U.S.-made M79 grenade.

The tank men said later they had no fear of the M79, but only of RPG antitank grenades, hard-tipped projectiles made to penetrate a tank's armor and then explode. Sandinista soldiers and one of the journalists later said the contras had fired several RPGs during the battle.

At one point the tank's gears froze. Barrero said later that with a well-placed RPG at that moment, we might have been "cooked."

Medrano, unable to move the tank, pulled desperately at his levers, as Berrero screamed at him to move. Barrero kept the turret swiveling, peppering all around them with machine-gun fire and pounding away with the cannon in all directions at anyone who might want a clear shot at them. The tank sat dead still for about two minutes and the atmosphere inside went from tense to desperate. The air filtration system was working, but the heat and smoke of the cannon blasts were still in the air.

Then a blast of their own cannon shook the gears loose, and we moved again.

Now the tank behind us was moving in reverse back down the road, and ours did the same. The enemy fire had diminished, but Barrero was still peppering the hillside with his machine gun. Medrano yelled to him to watch out for the Sandinista troops who were now in front of us.

Rounding the bend back down the road, I saw the journalists who had been atop the tank, now walking ahead of me. One of them, Luis Diaz, a television cameraman, had a shrapnel wound in the leg, but it was not serious and he was able to walk.

One Sandinista militiaman was killed and three were wounded in the ambush. The shooting had lasted about 40 minutes and the three young tankmen said it was the fiercest action they had seen in their six months in the war.

"If they weren't such cowards, they would shoot better," said Barrero. But the tanks had used much of their ammunition and had to turn back. It wasn't until much later in the day that three other tanks were able to reach the Sandinista command post.