HOLLYWOOD (AP) _ ''Rambo'' may have to borrow a six-shooter from ''Dirty Harry'' because of a new federal law that could cut the chatter of machine-gun fire in Hollywood.

Fully automatic weapons coming onto the market won't be available to film companies because the new law says machine guns may be sold only to police and the military.

''It was a last-minute amendment and it will have a serious impact on the entertainment industry,'' said Nancy Norell, a spokeswoman for the law's author, Sen. James McClure, R-Idaho. The amendment was introduced by Rep. Lawrence Smith, D-Fla.

With the popularity of such films as ''The Terminator,'' ''Commando,'' ''Rambo'' and ''Cobra,'' film producers have been vying to out-gun each other.

''The machine guns manufactured for the 'Rambo' ... adventure-type movies use real machine guns that are altered to shoot blanks,'' Ms. Norell said. ''Under the letter of the law they are still considered machine guns and can no longer be registered.''

Because the law outlaws sale or manufacture of any new machine guns except for police or law enforcement use, the film industry will not be allowed to buy or rent blank-firing machine guns known as property weapons.

''What this means, as far as Hollywood is concerned, is that new machine guns that come out will be unavailable,'' said Edward Leiter, a supplier of property weapons to the film industry.

''They cannot be manufactured or transferred to any individual or company,'' he said, adding that property guns the industry currently has cannot be replaced.

If a film producer needs a new kind of machine gun, the movie will have to be made outside the United States, Ms. Norell said.

The law was signed by President Reagan last month.

''We just didn't have anybody bring up the question of what impact it would have on the film industry,'' Smith said, suggesting that the film industry might be able to obtain a federal licence for property guns.