The sum was well below the USD 6.7 million demanded by Costa Rica for the environmental harm done to the area, and to compensate its efforts to restore it.
"The court concludes that the total amount of compensation to be awarded to Costa Rica is USD 378,890.59," judge Abdulqawi Ahmed Yusuf told the International Court of Justice (ICJ).
Managua has until April 2 to pay the amount, after which it will incur a higher rate of interest, judge Yusuf warned at the court in The Hague, in what was its first ever ruling for environmental damage.
The compensation ruling came more than two years after the ICJ found that Costa Rica had sovereignty over the area, basing its ruling in part on an 1858 treaty between the two countries.
More From This Section
The ICJ said Nicaragua had violated its neighbour's territory in 2010 by sending a small military contingent to set up an outpost there.
It also undertook dredging in the San Juan river and excavated three canals in the sensitive wetlands area.
But the neighbours failed to reach a deal, so the issue trundled back to the ICJ so judges could set the compensation amount.
The case is one of several disputes between the two countries which have ping-ponged back and forth in the UN's highest court, set up in 1945 to rule on border and territorial disputes between nations.
Judges later today were also to rule on two further border disputes between the Central American neighbours.
The two countries first held negotiations in 1976 to try to reach an agreement on the border which broadly follows the San Juan river, but talks have dragged on.
The case was first lodged with the ICJ in 2014, when Costa Rica maintained it had "exhausted its diplomatic means" to resolve the row.