Indian Prime Minister Rajiv Gandhi, in a turnabout from statements he made before meeting President Reagan last week, expressed confidence today that the United States is trying to stop Pakistan from making an atomic bomb.

"I am fairly satisfied that the United States will do everything it can" to keep Pakistan from becoming a nuclear weapons power, Gandhi said after returning from a five-nation tour that included his first visit to the United States as India's prime minister.

His words and tone were far different from ones he used two weeks ago in a meeting here with U.S. reporters. At that time, he accused Washington of taking a "soft line" on Pakistan's nuclear program and indicated that India might be forced into an atomic weapons program of its own if its neighbor develops a bomb.

Talking to reporters at an airport ceremony today, Gandhi acknowledged that U.S. efforts may not be enough to keep Pakistan from developing atomic weapons.

The switch in tone provided a clear example of how far his U.S. visit had gone to smooth out, at least for the moment, the often strained relations between the world's two largest democracies.

Gandhi, 40, called his talks with the Reagan administration "very good" and challenged a reporter who said Gandhi "had admitted" that he liked President Reagan. "I don't have to 'admit' liking President Reagan," Gandhi said.

"On the basis of the exchanges we had," Gandhi said, "our points of view have come much closer on certain issues. Where there were differences, we discussed those openly." He said he was satisfied with the talks in all areas, even though India and the United States failed to reach agreement on some issues.

It was clear that Pakistan remains the major sticking point between Washington and New Delhi, and Gandhi reiterated today India's view that U.S. sales of high performance weapons to Islamabad forces India to divert funds needed for development into arms purchases.

Pakistan appeared clearly concerned that the success of the Gandhi visit to the United States could hurt Islamabad's relations with the Reagan administration.

The Pakistani news agency, Pakistan Press International, was reported here as speculating in a dispatch from Washington that a new series of U.S. arms sales to Pakistan is likely to be held up as a result of the success of Gandhi's meetings with Reagan administration officials. A five-year, $1.6 billion arms credit program, including the sales of 40 F16 fighters, ends in 1986.

Gandhi said it was unlikely that India would enter into a major arms purchase agreements with the United States soon because New Delhi believed U.S. laws can stop delivery for political reasons.