Shruthi Aramandla’s education and her job are geared to New York City’s skyline. She did not want to go back to her native India and start all over again.

Ms. Aramandla, 24, who has a master’s degree from the Tandon School of Engineering at New York University, has been waiting anxiously for the federal government to publish its new rule on a foreign-worker training program so she would know whether she could stay longer — and perhaps one day permanently — in the United States.

The federal government will publish the rule on Friday, saying that international students earning degrees in science, technology, engineering and mathematics fields in the United States will now be eligible to stay for three years of on-the-job training. This is seven months longer than under the 2008 rule it replaces for the STEM Optional Practical Training program, known as OPT. The new rule will take effect on May 10.

Beyond offering graduates more experience in their fields, the extension serves another purpose. “If my work visa gets denied this year, I still have two more opportunities to apply, and I can keep working within the country,” said Ms. Aramandla, who wanted to be an engineer since she was 10, growing up in Chennai, India. She graduated from N.Y.U. in May; under the previous 29-month rule, she would have been able to stay only through October 2017.