The United States women's basketball team was shocked in the final of the Pan American Games tonight by a fast-breaking frantic Cuban team that rallied in the last five minutes for a 91-86 triumph.

The U.S. which had won 16 straight international games, including the world championships, in Korea this summer, was cursed by terrible second-half foul shooting, a questionable coaching decision and a general lack of poise at the end of a brilliant seesaw pressure game.

The Americans also were bedeviled by two leaping Cubans whose high wire acrobatics always seemed to come at crucial times - 5-foot-5 guard Margarita Skeet with 20 points, including half of Cuba's last 16, and 6-foot Caridad Despaigne, who had 23 points and 13 rebounds.

Painfully, the U.S. heroine was also the U.S. goat. Forward Rosie Walker, 6-2, from Stephen F. Austin, was the evening's high scorer with 27 points on twisting layups in traffic.

However, Walker at the foul line was a painful sight, as she missed 10 of 15 shots, including seven in the second half. She winced with every knuckleball attempt.

"Cuba showed poise and discipline. They also shot better than they usually do. But the free-throw line was crucial. Time and again we missed in the second half," said U.S. Coach Pat Head. "It broke our backs."

Head, in retrospect, may have to share some criticism for keeping two of her stars - Walker and Ann Meyers - out of the game with four fouls as Cuba turned a five-point deficit into a four-point lead before that pair returned.

The United States, trailing most of the first half, rallied to a 46-45 intermission-lead that seemed to demoralize the Cubans. That American momentum continued as the Americans built a 58-51 lead with 14 minutes to play.

Slowly, led by the reckless little Skeet, the Cubans cut the margin until Skeet took a fast-break pass in mid-air and banked in a layup for a 59-58 Cuba lead.

Walker's departure in the middle of the half with her fourth foul was compounded when Meyers, the club's sparkplug, picked up three hustling fouls in 58 seconds, giving her four also. When Meyers joined Walker on the bench, the United States led, 70-68, with 6:55 to play.

Without Meyers' pep and passing, and without Walker's force underneath, the U.S. offense, which had averaged 100.2 points-game in its five opening wins, sputtered.

Jill Rankin, with 14 points, and Nancy Lieberman, with 13, seemed overwhelmed by defenders as their mates stood and looked at each other, passing pointlessly. Perhaps if supershooter Carol Blazejowski, who averaged 31.7 points throughout her college career, had helped, the stagnation might have disappeared. But Blaze, in a tournament-long slump after strong play in the world championships, was scoreless tonight.

A three-point play by Despaigne tied the game at 75-75 with 5:09 left. That was the beginning of the end, as two more in the endless stream of breakaway Cuban layups off bomb passes gave the Islanders a 79-75 lead with 3:30 remaining.

America's last chance to tie came with 1:51 on the clock and the suffering Walker on the line with three to make two. The anti-U.S. crowd, chanting "Cuba, Cuba," rattled her as she missed two of three for an 81-80 deficit.

Then the Cuban clutch pair took over. Skeet hit a 10-foot fall-away jumper after pulling up off a baseline drive and Despaigne followed with a baseline turnaround for an 85-82 lead. Four more Skeet foul shots made the Cuban lead 89-84 with 19 seconds left.

Mary Decker, Eugene, Ore., sped to a Pan American Games track record of 4 minutes 5.7 seconds in the 1,500 meters and Julie Brown, Northridge, Calif., was second - her third silver in these Games.

Deby LaPlante, LaMesa, Calif., scored an easy victory in the 100-meter hurdles, giving the American women eight gold medals for the Games, matching their previous high total in Pan Am competition, set in 1967, and they have one full night left.

Pam Spencer of Northridge, Calif., won the high jump, 6-1 3/4, and Bob Coffman, a 28-year-old sporting goods store owner from Houston, set a Pan American record in winning the decathlon competition with 8,078 points, beating Bruce Jenner's 1975 mark of 8,045.

Mel Purcell, the United States' No. 3 tennis player from the University of Kentucky, beat Richardo Acuna of Chile, 7-5, 6-4, in the men's singles final, then teamed with Andy Kohlberg, Larchmont, N.Y. for the doubles title in a 6-3, 6-1 breeze against Chile.

Susan Hagey, La Jolla, Calif., who won the singles Thursday, and Ann Hendricksson, Mahtomedi, Minn., scored a 6-0, 6-2 victory over Canada in the women's doubles.