The Sandinista government has sharply built up its military forces battling to subdue counterrevolutionary guerrillas in these northern border hills and is building new defenses against a conventional invasion from Honduras.

The measures, put into effect throughout Nueva Segovia province during the past three months, reflect mounting concern in the Sandinista leadership over antigovernment raids from isolated guerrilla redoubts here and apparently genuine fears that Honduran forces with U.S. backing could get involved in the fighting against Nicaraguan troops.

Particularly troubling is a 200-square-mile area known as Arenales, in the central part of the province, where rebel forces have been holed up since late January, Sandinista officers in the area said in interviews.

The guerrillas crossed in from Honduras in two groups of about 300 each, the officers said, and since then have been striking out from their haven at civilian and military targets to erode Sandinista control in the area. As a result, road travel has become dangerous in the region. Civilians no longer travel at night. Even a jeepload of reserve soldiers carrying AK47 assault rifles hurried one recent afternoon to reach the security of an Army garrison before sunset.

Villagers in Jalapa, 30 miles to the northwest near the Honduran border, said they are forbidden by their Sandinista protectors to be on the dirt streets after 9 p.m.

The extent of military presence in the Nueva Segovia region contrasts sharply with what I saw on a previous visit here in December. Few patrols were visible then. Now jeeps, lumbering East German IFA trucks loaded with troops and foot patrols can be seen moving constantly on the dirt roads.

A drive through the region showed that the Sandinista Army also is preparing to defend against a possible larger scale attack from Honduras. Antiaircraft batteries can be seen poking out of the shaved-off tops of hills near Jalapa and Ciudad Sandino west of here.

Two rows of zig-zag trenches guard the road leading from the Honduran border to Jalapa. Recently dug earthworks are visible in nearby hillsides, apparently for artillery emplacements.

Reservists, called up for three-month stints under regular Army officers, sometimes click off the safety of their AK47s when passing through creekbeds or ravines that were the sites of previous ambushes. Drivers have orders to stay separated so that if the rebels attack, only one vehicle full of Sandinista troops can be hit at a time.

Ernesto Gustos, a reservist from Leon, clacked into readiness his AK47 and trained his eyes on the dry hillsides as he rode the other day in the back of a jeep down the road leading to the regional command post here.

"This will be a gift for the contras if we run into them," he said, using the local jargon for counterrevolutionaries.

The concern is real. Three Sandinista militiamen were killed Wednesday, for example, when a rebel unit struck at Hacienda Carmen near San Juan del Rio Coco west of here. Two days earlier, the driver of an ambulance was killed when rebels opened fire as the ambulance passed down the road in the same region.

The staying power and size of Nueva Segovia's guerrilla force set it apart from similar units operating in Matagalpa province to the south and Madriz to the east. These have been able only to harass occasional civilian and military targets with apparently random raids by small units, the officers reported.

Nueva Segovia rebel units, in contrast, have established themselves in the hills and, Sandinista commanders say, have been resupplied from across the Honduran border without leaving Nicaraguan territory. This marks a significant change in the way the guerrillas have been operating since they stepped up their attacks last summer against the 3 1/2-year-old Sandinista government.

Before, the rebel forces had been able to maintain such a prolonged presence only in the remote stretches of Zelaya province, on the Atlantic coast side of the country, aided there by the local Indian population often at loggerheads with Sandinista authorities.

The extent of counterrevolutionary activity in Nueva Segovia previously was unclear. It helps explain the concern voiced by Sandinista officials in Managua that had seemed out of proportion when measured against the threat in other, relatively calm areas such as Matagalpa.

To remain in Nueva Segovia, Sandinista officers reported, the rebels have press-ganged peasants into helping them transport food and ammunition, often by mule. Conversations with local residents indicated that willingness to cooperate with whoever has a gun also plays a role.

Capt. Rodrigo Gonzalez, who commands the Jalapa area, said the rebels are surrounded and soon will be wiped out or driven back into Honduras. Officers here at Quilali declared that the force has been cut nearly in half in recent clashes and pointed out that the area they roam in contains no roads and only a few small hamlets.

But the rebels' ability to resist attack in their redoubt and to come out repeatedly to maraud along the region's roads appears to have stymied Sandinista forces for the past three months. Ironically for a government that came to power through a guerrilla insurrection, the Sandinista Army here appears to be confronting the same problems as government forces fighting irregulars in other part of the world.

The Jalapa area is the only part of Nueva Segovia with a flat road that could be an avenue for troops and armor coming into Nicaragua from Honduras. For that reason, its defense is considered particularly important by Nicaraguan commanders.

On the highway from Managua to Jalapa, Sandinista troops were seen training on a pair of aging M4 medium tanks and a British-made Staghound armored personnel carrier left over from the Somoza dictatorship. There was no visible deployment of Nicaragua's more than 25 T55 Soviet-made tanks acquired since the 1979 revolution.

At another Army base, soldiers gathered around a stovepipe-sized 120-mm mortar. Farther north, a group was seen receiving instructions on operations of what appeared to be a small-caliber antiaircraft gun.

The military activity was in clear contrast to what was seen on earlier drives up the same road.

Foreign Minister Miguel D'Escoto warned again Thursday that the prolonged use of Honduran territory to organize attacks by the antigovernment forces could lead to war with Honduras. His words were seen as a way to raise the diplomatic ante rather than a prediction that such hostilities are near.

"This is more than anything a call to reflection and sanity," he said in an interview the next day in Managua. D'Escoto also said the Sandinista leadership worries that Honduran troops could join the U.S.-backed guerrilla units in raids on targets in Nicaragua, making a conflict more likely.

Carlos Nunez, one of the nine commanders who make up Nicaragua's top leadership, underlined the financial burden imposed by the military effort, which includes a 22,000-strong Army and between 12,000 and 20,000 ready reserves in the militia.

Nunez said the Sandinista leadership believes the counterrevolutionary effort is likely to require months of high-level military expenditures, adding: "We are not deluding ourselves. This is not going to be over tomorrow."