HUNTINGTON, W.Va. — In a sleek laboratory at Marshall University last month, four high school teachers hunched over a miniature steam-electric boiler, a tabletop replica of the gigantic machinery found in power plants.

They hooked the boiler to a small, whirring generator and tinkered with valves and knobs, looking for the most efficient way to turn coal, natural gas, nuclear or solar energy into electricity.

The teachers, who were attending a summer training program, are helping West Virginia in another kind of transformation. Long one of the poorest states, it is now leading the way in turning vocational education from a Plan B for underachieving students into what policy makers hope will be a fuel source for the state’s economic revival.

Simulated workplaces, overseen by teachers newly trained in important state industries like health, coal and even fracking, are now operating in schools across the state. Students punch a time clock, are assigned professional roles like foreman or safety supervisor, and are even offered several vacation days of their choice in addition to regular school breaks. (Many take time off during deer hunting season.)

Traditional math and English teachers have been reassigned to technical high schools, to make sure students on the vocational track still gain reading, writing and math skills.

And this fall, students enrolled in simulated workplaces will need to participate in one of the program’s boldest elements: random drug testing.

Given the extent of the state’s opioid crisis, employers “wouldn’t take anything we were doing seriously until we passed that hurdle,” said Barry Crist, principal of the Fayette Institute of Technology.

West Virginia’s heavy push on vocational education comes as leaders of both parties have talked about making it a priority, a shift from the No Child Left Behind era of education reform, in which college for everyone was often the goal. In 2015, fewer than half of 25- to 34-year-olds nationwide had earned an associate’s or bachelor’s degree, according to census figures.

“Vocational training is a great thing,” President Trump said a week before Election Day. “We’re going to start it up big league.” In June, he signed an executive order that redirected federal job training funds toward apprenticeships, in which students learn skills at actual work sites.

Democrats, too, are talking about vocational training. The agenda they introduced in July, “A Better Deal,” speaks of increasing support for “technical education that leads to a good job.”

But Mr. Trump’s budget calls for $166 million in cuts, a 15 percent reduction, in Perkins Act grants to the states, the government’s main funding stream for technical education in high school and college. The House passed a bipartisan reauthorization of the Perkins program in June, but the bill has not moved forward in the Senate. Even if it passes, the legislation will represent a tweak to the program, not a substantial new commitment of the type Mr. Trump and Democrats have touted.

When it comes to technical education, the United States is an outlier compared with other developed nations. Only 6 percent of American high school students are enrolled in a vocational course of study, according to a 2013 Department of Education report. In the United Kingdom, 42 percent are on the vocational track; in Germany, it’s 59 percent; in the Netherlands, 67 percent; and in Japan, 25 percent.

“We are so focused on academic routes as opposed to other routes that can be high quality,” said Mary Alice McCarthy, director of the Center on Education and Skills at New America and a former official at the Education and Labor Departments. “There’s a desperate need.”

West Virginia has especially big challenges transitioning students to life after high school. According to the Social Science Research Council, 17 percent of the state’s young adults are “disconnected,” neither working nor in school, the second-highest rate among states, behind only New Mexico.

But in few other states have the changes in vocational education — now rebranded as “career and technical education” — been as dramatic. Thirty-seven percent of West Virginia high school seniors completed a technical course of study in 2016, up from 18 percent in 2010.

Many are now in simulated workplaces where they learn to work with stethoscopes, welding torches and drafting tables as well as more sophisticated technology.

As an eighth grader, Dillon Brasse, who will be a senior this fall, planned to enter the vocational track to learn masonry. But on a tour of the Fayette Institute, he was fascinated by the computer-assisted drafting classroom, where students work with a 3-D printer, a laser engraver, a vinyl cutter and professional computer software like AutoDesk’s Inventor, which is used in product development.

In his classroom, Dillon said, music plays and students are permitted breaks throughout the day, like at a real work site. He and his classmates have designed and produced objects like saltshakers and fidget spinners, the faddish hand-held toys. “It’s a great experience,” Dillon said, because “you’re treated like an adult.”

That treatment now includes drug testing. West Virginia policy makers say such testing prepares students for the work force, where employers are increasingly checking for drug use, though the American Academy of Pediatrics opposes mandatory testing, citing a “lack of solid evidence” for its effectiveness in helping teenagers avoid substances.

Rachel Peal, who graduated this spring from the pre-engineering simulated workplace program at the Fayette Institute, said the protocol kicked up little protest among her peers. They are well aware that opioid users can’t get or hold down jobs, she said.

“A lot of kids and their families saw the struggle,” she said. “It’s an epidemic here.”

Ron Foster, president of Foster Supply Inc., an 80-employee construction and fabrication firm, has hired eight graduates of the state’s high school simulated workplace program over the past two years. They can earn as much as $15 per hour doing jobs such as welding and machinery repair.

Compared with previous hires, this group is more punctual and focused on building a career, Mr. Foster said. “ If you’re dedicated enough to go through that program, you’re more apt to do a good, quality job,” he said.

But far from being strictly a job training program for teenagers, classes like Advanced Career Energy and Power, the four-course sequence for which teachers were training at Marshall University, require math and physics instruction as rigorous as in the College Board’s Advanced Placement track. Of the four teachers tinkering with the miniature boiler, three came from traditional math and science departments.

The hope is to prepare students for higher skilled work. In the fracking industry, for example, they might qualify for jobs in equipment maintenance or environmental compliance instead of laying pipeline, an entry-level and sometimes dangerous job.

About half of the state’s technical-track graduates go on to two- or four-year colleges. Dillon Brasse, for example, is now planning to pursue a bachelor’s degree in engineering or architecture.

“There’s so much technical information that’s needed today,” said Jeri Matheney, communications director for Appalachian Power, which runs coal, natural gas and hydropower plants in West Virginia. “Where we counted on just on-the-job training 50 years ago, that has changed.”

The classes mimic the workplace in another way, one perhaps not intended. According to federal data from the 2015-16 school year, 90 percent of West Virginia high school technical students concentrating in science fields were male, while 89 percent of those concentrating in health fields were female.

And economists debate whether better vocational education, at either the high school or college level, can be a large-scale fix for underemployment. After all, if firms aren’t hiring, even a highly skilled worker will struggle to land a job.

The energy sector is especially cyclical, a challenge for the Appalachian region. Nationwide, the number of jobs in coal and gas fell by more than a quarter between 2014 and 2016, and hiring is only now beginning to creep back up.

Still, West Virginia educators and policy makers are believers in the “skills gap” hypothesis.

Kathy D’Antoni, the state director for career and technical education since 2010, said a better-educated work force would attract new types of jobs to the state. And she would like to see more support from Washington targeted toward struggling rural states. West Virginia delivered the largest pro-Trump majority in the November election, a margin of 42 percentage points.

Adjusted for inflation, West Virginia’s funding through the Perkins Act has been flat since the program’s inception in 1984, according to the state. Asked about the president’s proposed cuts to Perkins, Liz Hill, a spokeswoman for the federal Department of Education, said innovation in career and technical education would continue locally through “public-private partnerships” between schools and industry.

Ms. D’Antoni said she appreciated the attention Mr. Trump has given to vocational education. But, she said, “I want to see the action.”