When Hewlett-Packard recently appointed Carleton ''Carly'' Fiorina as president and chief executive, the move symbolized two major trends in corporate America. Lost behind the obvious one - more women are gradually rising to the top - is another trend expected to have a huge impact over the next decade.

Although HP, the Palo Alto, Calif., company widely regarded as one of the best places to work in the world, has tens of thousands of employees, its directors weren't comfortable promoting one of their current workers to chief executive. They chose Fiorina, who had been president of Lucent Technologies' global service provider business.HP is hardly alone. Only a few companies, such as General Electric and Pepsi, have a reputation for training employees well enough to take over, said author William Byham, chief executive of Development Dimensions International in Bridgeville, Pa. ''There aren't many in the Silicon Valley.''

A recent survey of 50 companies by his firm found that barely a third have high confidence that they will be able to find qualified leaders in the next five years, said Byham, author of such books as ''Zapp! The Lightning of Empowerment'' and ''Grow Your Own Leaders,'' due to be published in January. And he expects the problem to get worse.

''Companies have shrunk their middle management, which has been the growing ground'' for future leaders, said Byham. ''The retirement age is going down, while the requirements of the job are going up.''

Although organizations certainly have good reasons to bring in people from outside, doing so leads to four potential problems:

* Resentment from long-time employees who didn't get promoted. That can make them less loyal to the company, making the new boss's job even harder.

* The high costs of recruiting and replacement. In a survey, Byham's firm found that the average first-year cost for replacing an executive is $750,000.

* Outsiders fail in their jobs about half the time, according to Byham.

* The new person probably will have less long-term loyalty to the company than someone who spent years there and rose through the ranks. Byham's firm did a study showing that although many leaders pursue development for practical and personal growth, 70 percent said they do it to make themselves more marketable for other jobs - not necessarily to help their current organizations.

Combined with the cutback in middle management is the aging work force. In the San Francisco area, for example, about half the senior managers at large companies are expected to retire within five years, Byham said. That means the few who do have management skills will be in high demand, while those companies that have not developed executives will be in trouble.

''There is no statistical reason why the demand is not going to go up,'' Byham said.

He adds that some companies kid themselves by having a list of successors on the chain of command, knowing deep down that those people don't have the skills or training to take over if the key person leaves. Or they may have an eye on rising talents - only to see them move on to other companies.

''You have great hopes for this person,'' Byham said, ''but nobody ever told them.''

For a company to develop its own leaders, Byham said the upper management first must be strongly committed to it. That in itself can be a problem, as some insecure managers don't want to train people to take their place, fearing that they might be forced into retirement earlier than they had planned.

He said the idea of identifying a successor for a specific job is out of date because workplaces and global business conditions change so frequently, so companies are better off doing what top football teams do when drafting players from college: Look for the ''best athlete available.'' By teaching potential leaders many general skills, Byham said, companies will be able to find the right people for the right spots as they evolve.

Although all workers should have good opportunities, Byham says, it is important to identify several people for the ''fast track,'' giving them the kinds of assignments that will develop their management skills. The companies need to look at the people's talents, their willingness to work the kinds of long hours management often demands, and any other factors the company might want, such as ethnic diversity.

''You're never going to get ethnic diversity by just looking at the people who are ready now. You have to look farther down the organization.''

For companies that want to develop those leaders, Byham offers several tips, including:

* Ask top executives what experiences potential leaders should have to develop the skills necessary for rising to the top.

* Put people through assessment centers, simulations that offer a day in the life of a mythical manager, to see what skills they need to work on.

* Make sure that ''fast track'' people know they have a place in the organization's future.

* Have executive coaches for high potential candidates. Sometimes pairing senior executives with younger partners can have dual benefits: It develops skills for the younger partner while enticing the executive to postpone retirement for a year or two.