The city is set to expand its computer science offerings next fall.

The White House announced Monday that New York City will get part of a $20 million National Science Foundation grant to recruit and train 100 high school educators over the next three years, part of a larger effort to better prepare students for the increasing number of technology-related jobs and increase diversity in the field.

The first 30 of those 100 teachers will start teaching an Advanced Placement-aligned computer science course next fall, based on a curriculum developed by the University of California, Berkeley called “Beauty and Joy of Computing.”

UC Berkeley’s course material will inform the development of the new AP Computer Science Principles course set to launch nationwide in 2016. The city will receive $6.4 million to support its computer science expansion, according to the Department of Education, including training teachers during the transition.

The AP initiative adds to recent efforts underway at the city Department of Education to bring computer science education into more schools.

Last year, the city selected 20 middle and high schools to pilot a software engineering program aimed at bringing computer science education to more students than just those in advanced classes. It also launched its own teacher training plan to bring in 120 computer science teachers over the course of two summers.

And this year, the state Board of Regents voted to ease graduation requirements so that schools can now create and offer classes in subjects like computer science that hone workforce skills while also allowing students to earn credits toward their diploma.

The announcement by the White House, which came at the start of a nationwide week-long campaign designed to raise interest in computer science, is also focused on addressing gender and racial disparities among students already taking the classes. In New York State last year, 2,734 students took the AP Computer Science exam, of whom 18 percent were female, 4 percent were black and 8 percent are Hispanic, according to the College Board.

“The reason why there’s not as many black and Latino students in computer science is because this is a field that’s mostly taught in suburban private schools,” said Code.org CEO Hadi Partovi, who visited M.S. 88 in Brooklyn on Tuesday as part of a to spark interest in the subject. Partovi said females are underrepresented because “there is a stereotype that girls shouldn’t do this.”

Students taking AP computer science in New York City are more likely to be females than other parts of the state and country. In 2012, 30 percent of the city’s AP Computer Science test-takers in 2012 were females.